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/rttest test-schema.xml
Date Wed, 21 Jan 2004 23:05:58 GMT
mpoeschl    2004/01/21 15:05:58

  Modified:    src/generator/src/templates/om Object.vm
                        ObjectWithManager.vm
               xdocs    changes.xml
               src/rttest test-schema.xml
  Log:
  TRQS97: Fix bad syntax in generated model when using primary keys of
          short or byte.
  
  Revision  Changes    Path
  1.12      +21 -4     db-torque/src/generator/src/templates/om/Object.vm
  
  Index: Object.vm
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/templates/om/Object.vm,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Object.vm	21 Jan 2004 22:40:26 -0000	1.11
  +++ Object.vm	21 Jan 2004 23:05:57 -0000	1.12
  @@ -95,6 +95,9 @@
           #set ($defVal = "= new StringKey($quote$defaultValue$quote)")
         #elseif ($cjtype == 'Byte')
           #set ($defVal = "= new ${cjtype}((byte) $defaultValue)")
  +      #elseif ($cjtype == "Short")
  +        #set ( $quote = '"' )
  +        #set ($defVal = "= new Short($quote$defaultValue$quote)")             
         #else
           #if (!$col.isPrimitive() && $cjtype != "String")
             #set ( $defaultValue = "new ${cjtype}($defaultValue)" )
  @@ -265,12 +268,19 @@
         #set ( $column = $table.getColumn($columnName) )
         #set ( $colFKName = $fk.LocalForeignMapping.get($columnName) )
         #set ( $colFK = $tblFK.getColumn($colFKName) )
  +      #set ( $fktype = $colFK.JavaNative )
  +      #set ( $casttype = "" )
           if (v == null)
           {
         #if($colFK.Primitive)
  -        #set ($coldefval = "0")
  +        #if ($fktype == "short")
  +          #set ($casttype = "(short)")
  +        #elseif($fktype == "byte")
  +          #set ($casttype = "(byte)")
  +        #end
  +        #set ($coldefval =  "0") 
           #set ($coldefval = $column.DefaultValue)
  -            set${column.JavaName}($coldefval);
  +            set${column.JavaName}($casttype $coldefval);
         #else
               set${column.JavaName}(($column.JavaNative) null);
         #end
  @@ -1445,9 +1455,16 @@
     #foreach ($col in $table.Columns)
       #if ($col.isPrimaryKey())
         #if($col.Primitive)
  -        #set ($coldefval = "0")
  +		#set ($fktype = $col.JavaNative)
  +	    #set ($casttype = "")
  +        #if ($fktype == "short")
  +          #set ($casttype = "(short)")
  +        #elseif($fktype == "byte")
  +          #set ($casttype = "(byte)")
  +        #end
  +        #set ($coldefval = "0") 
           #set ($coldefval = $col.DefaultValue)
  -        copyObj.set${col.JavaName}($coldefval);
  +        copyObj.set${col.JavaName}($casttype$coldefval);
         #else
           #set ( $pkid = "null" )
           #set ( $cjtype = $col.JavaNative )
  
  
  
  1.8       +18 -2     db-torque/src/generator/src/templates/om/ObjectWithManager.vm
  
  Index: ObjectWithManager.vm
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/templates/om/ObjectWithManager.vm,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ObjectWithManager.vm	21 Jan 2004 22:40:26 -0000	1.7
  +++ ObjectWithManager.vm	21 Jan 2004 23:05:57 -0000	1.8
  @@ -96,6 +96,9 @@
           #set ($defVal = "= new StringKey($quote$defaultValue$quote)")
         #elseif ($cjtype == 'Byte')
           #set ($defVal = "= new ${cjtype}((byte) $defaultValue)")
  +      #elseif ($cjtype == "Short")
  +        #set ( $quote = '"' )
  +        #set ($defVal = "= new Short($quote$defaultValue$quote)")             
         #else
           #if (!$col.isPrimitive() && $cjtype != "String")
             #set ( $defaultValue = "new ${cjtype}($defaultValue)" )
  @@ -269,12 +272,19 @@
         #set ( $column = $table.getColumn($columnName) )
         #set ( $colFKName = $fk.LocalForeignMapping.get($columnName) )
         #set ( $colFK = $tblFK.getColumn($colFKName) )
  +      #set ( $fktype = $colFK.JavaNative )
  +      #set ( $casttype = "" )
           if (v == null)
           {
         #if($colFK.Primitive)
  -        #set ($coldefval = "0")
  +        #if ($fktype == "short")
  +          #set ($casttype = "(short)")
  +        #elseif($fktype == "byte")
  +          #set ($casttype = "(byte)")
  +        #end
  +        #set ($coldefval =  "0") 
           #set ($coldefval = $column.DefaultValue)
  -            set${column.JavaName}($coldefval);
  +            set${column.JavaName}($casttype $coldefval);
         #else
               set${column.JavaName}(($column.JavaNative) null);
         #end
  @@ -307,6 +317,12 @@
         #set ( $argsize = $argsize + 1 )
       #end
   
  +    /**
  +     * Get the associated $interfaceName object
  +     *
  +     * @return the associated $interfaceName object
  +     * @throws TorqueException
  +     */
       public $interfaceName get${pVarName}() throws TorqueException
       {
           if ( $conditional )
  
  
  
  1.121     +4 -1      db-torque/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/db-torque/xdocs/changes.xml,v
  retrieving revision 1.120
  retrieving revision 1.121
  diff -u -r1.120 -r1.121
  --- changes.xml	7 Dec 2003 13:23:59 -0000	1.120
  +++ changes.xml	21 Jan 2004 23:05:58 -0000	1.121
  @@ -8,7 +8,10 @@
     <body>
   
       <release version="3.2-alpha" date="in CVS">
  -
  +      <action dev='mpoeschl' type='fix'>
  +        TRQS97: Fix bad syntax in generated model when using primary keys of
  +        short or byte.
  +      </action>
         <action dev='mpoeschl' type='remove'>
           Remove support for old properties (properties without 'torque.' prefix)
         </action>
  
  
  
  1.18      +16 -1     db-torque/src/rttest/test-schema.xml
  
  Index: test-schema.xml
  ===================================================================
  RCS file: /home/cvs/db-torque/src/rttest/test-schema.xml,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- test-schema.xml	31 Oct 2003 20:48:42 -0000	1.17
  +++ test-schema.xml	21 Jan 2004 23:05:58 -0000	1.18
  @@ -153,5 +153,20 @@
       <column name="bint_value" required="true" type="BOOLEANINT" />
       <column name="bchar_value" required="true" type="BOOLEANCHAR" />
     </table>
  -  
  +
  +  <!-- TRQS97 -->
  +  <table name="LEAGUES_OBJECT" description="Contains all leagues">
  +    <column name="LEAGUEID" primaryKey="true" required="true" type="TINYINT" javaType="object"/>
  +    <column name="LEAGUENAME" required="false" size="100" type="VARCHAR"/>
  +    <column name="LEAGUEYEAR" required="false" type="INTEGER" javaType="object"/>
  +    <column name="LEAGUESCORETYPE" required="false" type="SMALLINT" default="0" javaType="object"/>
  +  </table>
  +
  +  <table name="LEAGUES_PRIMITIVE" description="Contains all leagues">
  +    <column name="LEAGUEID" primaryKey="true" required="true" type="TINYINT" javaType="primitive"/>
  +    <column name="LEAGUENAME" required="false" size="100" type="VARCHAR"/>
  +    <column name="LEAGUEYEAR" required="false" type="INTEGER" javaType="primitive"/>
  +    <column name="LEAGUESCORETYPE" required="false" type="SMALLINT" default="0" javaType="primitive"/>
  +  </table>
  +
   </database>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message