db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpoes...@apache.org
Subject cvs commit: db-torque/src/java/org/apache/torque/engine/database/model TypeMap.java
Date Tue, 27 May 2003 22:57:41 GMT
mpoeschl    2003/05/27 15:57:40

  Modified:    src/templates/om Tag: TORQUE_3_0_BRANCH Peer.vm
               src/java/org/apache/torque/engine/database/model Tag:
                        TORQUE_3_0_BRANCH TypeMap.java
  Log:
  Removed logic to convert strings to boolean type.  The
    Villiage API will now be used for this.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.45.2.2  +18 -38    db-torque/src/templates/om/Attic/Peer.vm
  
  Index: Peer.vm
  ===================================================================
  RCS file: /home/cvs/db-torque/src/templates/om/Attic/Peer.vm,v
  retrieving revision 1.45.2.1
  retrieving revision 1.45.2.2
  diff -u -r1.45.2.1 -r1.45.2.2
  --- Peer.vm	27 May 2003 22:24:58 -0000	1.45.2.1
  +++ Peer.vm	27 May 2003 22:57:40 -0000	1.45.2.2
  @@ -325,7 +325,6 @@
       #end
       }
   
  -
       /**
        * Create a new object of type cls from a resultset row starting
        * from a specified offset.  This is done so that you can select
  @@ -378,28 +377,9 @@
           try
           {
           #set ( $n=0 )
  -        #set ( $boolean = "boolean" )
           #foreach ($col in $table.Columns)
  -            #if ($col.isBooleanChar())
  -            $boolean b = "Y".equals(row.getValue(offset + $n).$col.VillageMethod);
  -            #set ( $boolean = "" )
  -                #if ($col.isUsePrimitive())
  -            obj.set${col.JavaName}(b);
  -                #else
  -            obj.set${col.JavaName}(b ? Boolean.TRUE : Boolean.FALSE);
  -                #end
  -            #elseif ($col.isBooleanInt())
  -            $boolean b = (row.getValue(offset + $n).$col.VillageMethod != 0);
  -                #set ( $boolean = "" )
  -                #if ($col.isUsePrimitive())
  -            obj.set${col.JavaName}(b);
  -                #else
  -            obj.set${col.JavaName}(b ? Boolean.TRUE : Boolean.FALSE);
  -                #end
  -            #else
               obj.set${col.JavaName}(row.getValue(offset + $n).$col.VillageMethod);
  -            #end
  -                #set ( $n = $n + 1 )
  +            #set ( $n = $n + 1 )
           #end
           }
           catch (DataSetException e)
  @@ -825,7 +805,7 @@
        */
       public static void doInsert($table.JavaName obj) throws TorqueException
       {
  -        #if ($table.IdMethod.equals("none") || $table.PrimaryKeys.size() == 0)
  +        #if ($table.IdMethod.equals("none") || $table.PrimaryKey.size() == 0)
           doInsert(buildCriteria(obj));
           #else
           obj.setPrimaryKey(doInsert(buildCriteria(obj)));
  @@ -868,7 +848,7 @@
       public static void doInsert($table.JavaName obj, Connection con)
           throws TorqueException
       {
  -        #if ($table.IdMethod.equals("none") || $table.PrimaryKeys.size() == 0)
  +        #if ($table.IdMethod.equals("none") || $table.PrimaryKey.size() == 0)
           doInsert(buildCriteria(obj), con);
           #else
           obj.setPrimaryKey(doInsert(buildCriteria(obj), con));
  @@ -943,12 +923,12 @@
       public static Criteria buildCriteria( ObjectKey pk )
       {
           Criteria criteria = new Criteria();
  -  #if ($table.PrimaryKeys.size() == 1)
  -            criteria.add($table.PrimaryKeys.get(0).Name.toUpperCase(), pk);
  +  #if ($table.PrimaryKey.size() == 1)
  +            criteria.add($table.PrimaryKey.get(0).Name.toUpperCase(), pk);
     #else
           SimpleKey[] keys = (SimpleKey[])pk.getValue();
       #set ( $i = 0 )
  -    #foreach ($col in $table.PrimaryKeys)
  +    #foreach ($col in $table.PrimaryKey)
           #set ( $cup=$col.Name.toUpperCase() )
               criteria.add($cup, keys[$i]);
           #set ( $i = $i + 1 )
  @@ -974,7 +954,7 @@
   
   #end ## ends if (!$table.isAlias())
   
  -#if ($table.PrimaryKeys.size() > 0)
  +#if ($table.PrimaryKey.size() > 0)
   
     #if ($table.isAlias())
       #set ($retrieveMethod = "retrieve${table.JavaName}ByPK")
  @@ -1089,8 +1069,8 @@
           else
           {
               Criteria criteria = new Criteria();
  -  #if ($table.PrimaryKeys.size() == 1)
  -            criteria.addIn( $table.PrimaryKeys.get(0).Name.toUpperCase(), pks );
  +  #if ($table.PrimaryKey.size() == 1)
  +            criteria.addIn( $table.PrimaryKey.get(0).Name.toUpperCase(), pks );
     #else
               Iterator iter = pks.iterator();
               while (iter.hasNext())
  @@ -1098,7 +1078,7 @@
                   ObjectKey pk = (ObjectKey)iter.next();
                   SimpleKey[] keys = (SimpleKey[])pk.getValue();
                   #set ( $i = 0 )
  -                #foreach ($col in $table.PrimaryKeys)
  +                #foreach ($col in $table.PrimaryKey)
                       #set ( $cup=$col.Name.toUpperCase() )
                       Criteria.Criterion c$i = criteria.getNewCriterion(
                           $cup, keys[$i], Criteria.EQUAL);
  @@ -1116,21 +1096,21 @@
           return objs;
       }
   
  -#end ## ends if($table.PrimaryKeys.size() > 0)
  +#end ## ends if($table.PrimaryKey.size() > 0)
   
  -#if ($table.PrimaryKeys.size() > 1)
  +#if ($table.PrimaryKey.size() > 1)
   #set ( $comma = false )
       /**
        * retrieve object using using pk values.
        *
  -#foreach ($col in $table.PrimaryKeys)
  +#foreach ($col in $table.PrimaryKey)
       #set ( $clo=$col.Name.toLowerCase() )
       #set ( $cjtype= $col.JavaNative )
        * @param $clo $cjtype
   #end
        */
       public static $table.JavaName ${retrieveMethod}(
  -#foreach ($col in $table.PrimaryKeys)
  +#foreach ($col in $table.PrimaryKey)
       #set ( $clo=$col.Name.toLowerCase() )
       #set ( $cjtype = $col.JavaNative )
       #if ($comma),#end $cjtype $clo
  @@ -1145,7 +1125,7 @@
              db = Torque.getConnection(DATABASE_NAME);
              retVal = retrieveByPK(
              #set ( $comma = false )
  -           #foreach ($col in $table.PrimaryKeys)
  +           #foreach ($col in $table.PrimaryKey)
                  #set ( $clo=$col.Name.toLowerCase() )
                  #if ($comma),#end $clo
                  #set ( $comma = true )
  @@ -1163,7 +1143,7 @@
       /**
        * retrieve object using using pk values.
        *
  -#foreach ($col in $table.PrimaryKeys)
  +#foreach ($col in $table.PrimaryKey)
       #set ( $clo=$col.Name.toLowerCase() )
       #set ( $cjtype= $col.JavaNative )
        * @param $clo $cjtype
  @@ -1171,7 +1151,7 @@
        * @param Connection con
        */
       public static $table.JavaName ${retrieveMethod}(
  -#foreach ($col in $table.PrimaryKeys)
  +#foreach ($col in $table.PrimaryKey)
       #set ( $clo=$col.Name.toLowerCase() )
       #set ( $cjtype = $col.JavaNative )
       #if ($comma),#end $cjtype $clo
  @@ -1181,7 +1161,7 @@
       {
   
           Criteria criteria = new Criteria(5);
  -#foreach ($col in $table.PrimaryKeys)
  +#foreach ($col in $table.PrimaryKey)
       #set ( $cup=$col.Name.toUpperCase() )
       #set ( $clo=$col.Name.toLowerCase() )
           criteria.add($cup, $clo);
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.8.2.1   +5 -5      db-torque/src/java/org/apache/torque/engine/database/model/Attic/TypeMap.java
  
  Index: TypeMap.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/engine/database/model/Attic/TypeMap.java,v
  retrieving revision 1.8
  retrieving revision 1.8.2.1
  diff -u -r1.8 -r1.8.2.1
  --- TypeMap.java	2 Dec 2002 23:21:16 -0000	1.8
  +++ TypeMap.java	27 May 2003 22:57:40 -0000	1.8.2.1
  @@ -216,8 +216,8 @@
       public static final String DATE_VILLAGE_METHOD = "asUtilDate()";
       public static final String TIME_VILLAGE_METHOD = "asUtilDate()";
       public static final String TIMESTAMP_VILLAGE_METHOD = "asUtilDate()";
  -    public static final String BOOLEANCHAR_VILLAGE_METHOD = "asString()";
  -    public static final String BOOLEANINT_VILLAGE_METHOD = "asInt()";
  +    public static final String BOOLEANCHAR_VILLAGE_METHOD = "asBoolean()";
  +    public static final String BOOLEANINT_VILLAGE_METHOD = "asBoolean()";
   
       public static final String BIT_VILLAGE_OBJECT_METHOD = "asBooleanObj()";
       public static final String TINYINT_VILLAGE_OBJECT_METHOD = "asByteObj()";
  @@ -227,8 +227,8 @@
       public static final String REAL_VILLAGE_OBJECT_METHOD = "asFloatObj()";
       public static final String FLOAT_VILLAGE_OBJECT_METHOD = "asDoubleObj()";
       public static final String DOUBLE_VILLAGE_OBJECT_METHOD = "asDoubleObj()";
  -    public static final String BOOLEANCHAR_VILLAGE_OBJECT_METHOD = "asString()";
  -    public static final String BOOLEANINT_VILLAGE_OBJECT_METHOD = "asInt()";
  +    public static final String BOOLEANCHAR_VILLAGE_OBJECT_METHOD = "asBooleanObj()";
  +    public static final String BOOLEANINT_VILLAGE_OBJECT_METHOD = "asBooleanObj()";
   
       public static final String CHAR_PP_METHOD = "getString(ppKey)";
       public static final String VARCHAR_PP_METHOD = "getString(ppKey)";
  
  
  

Mime
View raw message