mpoeschl    2003/08/07 14:27:46

  Modified:    src/generator/src/templates/sql/base/postgresql columns.vm
               src/generator/src/templates/sql/base/hypersonic columns.vm
               src/generator/src/templates/sql/base/interbase columns.vm
               src/generator/src/templates/sql/base/axion columns.vm
               src/generator/src/templates/sql/base/cloudscape columns.vm
               src/generator/src/templates/sql/base/msaccess columns.vm
               src/generator/src/templates/sql/base/db2400 columns.vm
               xdocs    changes.xml
               src/generator/src/templates/sql/base/db2 columns.vm
               src/generator/src/templates/sql/base/mssql columns.vm
               src/generator/src/templates/sql/base/mysql columns.vm
               src/generator/src/templates/sql/base/sybase columns.vm
               src/rttest test-schema.xml
  Log:
  TRQS178: use sql autoincrement only if idMethod is native
  
  Revision  Changes    Path
  1.2       +5 -1      
db-torque/src/generator/src/templates/sql/base/postgresql/columns.vm
  
  Index: columns.vm
  ===================================================================
  RCS file: 
/home/cvs/db-torque/src/generator/src/templates/sql/base/postgresql/columns.vm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- columns.vm        10 Feb 2003 13:18:47 -0000      1.1
  +++ columns.vm        7 Aug 2003 21:27:46 -0000       1.2
  @@ -16,7 +16,11 @@
       #end
       #set ( $nullString = $strings.select($col.isNotNull(), 
$dbprops.get("NOTNULL"),"") )
       #set ( $entry = "$col.Name $type $size $default $nullString" )
  -    #set ( $autoIncrement = $dbprops.get("AUTOINCREMENT") )
  +    #if ($col.isAutoIncrement() && $table.IdMethod == "native")
  +      #set ( $autoIncrement = $dbprops.get("AUTOINCREMENT") )
  +    #else
  +      #set ( $autoIncrement = " " )
  +    #end    
       #set ( $entry = $strings.select($col.isAutoIncrement(), "$col.Name 
$autoIncrement", $entry) )
   ##
   ## the following works if you want to inline your foreign keys
  
  
  
  1.2       +5 -1      
db-torque/src/generator/src/templates/sql/base/hypersonic/columns.vm
  
  Index: columns.vm
  ===================================================================
  RCS file: 
/home/cvs/db-torque/src/generator/src/templates/sql/base/hypersonic/columns.vm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- columns.vm        10 Feb 2003 13:18:48 -0000      1.1
  +++ columns.vm        7 Aug 2003 21:27:46 -0000       1.2
  @@ -3,7 +3,11 @@
       #set ( $size = $col.printSize() )
       #set ( $default = $col.DefaultSetting )
       #set ( $nullString = $strings.select($col.isNotNull(), 
$dbprops.get("NOTNULL"),"") )
  -    #set ( $autoIncrement = $strings.select($col.isAutoIncrement(), 
$dbprops.get("AUTOINCREMENT"),"") )
  +    #if ($col.isAutoIncrement() && $table.IdMethod == "native")
  +      #set ( $autoIncrement = $dbprops.get("AUTOINCREMENT") )
  +    #else
  +      #set ( $autoIncrement = " " )
  +    #end    
       #set ( $entry = "$col.Name $type $size $autoIncrement," )
       $strings.sub($strings.collapseSpaces($entry)," ,",",")
   #end
  
  
  
  1.2       +5 -1      
db-torque/src/generator/src/templates/sql/base/interbase/columns.vm
  
  Index: columns.vm
  ===================================================================
  RCS file: 
/home/cvs/db-torque/src/generator/src/templates/sql/base/interbase/columns.vm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- columns.vm        10 Feb 2003 13:18:44 -0000      1.1
  +++ columns.vm        7 Aug 2003 21:27:46 -0000       1.2
  @@ -3,7 +3,11 @@
       #set ( $size = $col.printSize() )
       #set ( $default = $col.DefaultSetting )
       #set ( $nullString = $strings.select($col.isNotNull(), 
$dbprops.get("NOTNULL"),"") )
  -    #set ( $autoIncrement = $strings.select($col.isAutoIncrement(), 
$dbprops.get("AUTOINCREMENT"),"") )
  +    #if ($col.isAutoIncrement() && $table.IdMethod == "native")
  +      #set ( $autoIncrement = $dbprops.get("AUTOINCREMENT") )
  +    #else
  +      #set ( $autoIncrement = " " )
  +    #end    
       #set ( $colName = $strings.concat(['"',$col.Name,'"']) )
       #set ( $entry = "$colName $type $size $default $nullString $autoIncrement," )
       $strings.sub($strings.collapseSpaces($entry)," ,",",")
  
  
  
  1.2       +5 -1      db-torque/src/generator/src/templates/sql/base/axion/columns.vm
  
  Index: columns.vm
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/templates/sql/base/axion/columns.vm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- columns.vm        10 Feb 2003 13:18:43 -0000      1.1
  +++ columns.vm        7 Aug 2003 21:27:46 -0000       1.2
  @@ -3,7 +3,11 @@
       #set ( $size = $col.printSize() )
       #set ( $default = $col.DefaultSetting )
       #set ( $nullString = $strings.select($col.isNotNull(), 
$dbprops.get("NOTNULL"),"") )
  -    #set ( $autoIncrement = $strings.select($col.isAutoIncrement(), 
$dbprops.get("AUTOINCREMENT"),"") )
  +    #if ($col.isAutoIncrement() && $table.IdMethod == "native")
  +      #set ( $autoIncrement = $dbprops.get("AUTOINCREMENT") )
  +    #else
  +      #set ( $autoIncrement = " " )
  +    #end    
       #set ( $entry = "$col.Name $type $autoIncrement," )
       $strings.sub($strings.collapseSpaces($entry)," ,",",")
   #end
  
  
  
  1.2       +13 -9     
db-torque/src/generator/src/templates/sql/base/cloudscape/columns.vm
  
  Index: columns.vm
  ===================================================================
  RCS file: 
/home/cvs/db-torque/src/generator/src/templates/sql/base/cloudscape/columns.vm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- columns.vm        10 Feb 2003 13:18:45 -0000      1.1
  +++ columns.vm        7 Aug 2003 21:27:46 -0000       1.2
  @@ -1,9 +1,13 @@
  -#foreach ($col in $table.Columns)
  -    #set ( $type = $dbprops.get($col.Type) )
  -    #set ( $size = $col.printSize() )
  -    #set ( $default = $col.DefaultSetting )
  -    #set ( $nullString = $strings.select($col.isNotNull(), 
$dbprops.get("NOTNULL"),"") )
  -    #set ( $autoIncrement = $strings.select($col.isAutoIncrement(), 
$dbprops.get("AUTOINCREMENT"),"") )
  -    #set ( $entry = "$col.Name $type $size $autoIncrement," )
  -    $strings.sub($strings.collapseSpaces($entry)," ,",",")
  -#end
  +#foreach ($col in $table.Columns)
  +    #set ( $type = $dbprops.get($col.Type) )
  +    #set ( $size = $col.printSize() )
  +    #set ( $default = $col.DefaultSetting )
  +    #set ( $nullString = $strings.select($col.isNotNull(), 
$dbprops.get("NOTNULL"),"") )
  +    #if ($col.isAutoIncrement() && $table.IdMethod == "native")
  +      #set ( $autoIncrement = $dbprops.get("AUTOINCREMENT") )
  +    #else
  +      #set ( $autoIncrement = " " )
  +    #end    
  +    #set ( $entry = "$col.Name $type $size $autoIncrement," )
  +    $strings.sub($strings.collapseSpaces($entry)," ,",",")
  +#end
  
  
  
  1.2       +5 -1      
db-torque/src/generator/src/templates/sql/base/msaccess/columns.vm
  
  Index: columns.vm
  ===================================================================
  RCS file: 
/home/cvs/db-torque/src/generator/src/templates/sql/base/msaccess/columns.vm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- columns.vm        10 Feb 2003 13:18:48 -0000      1.1
  +++ columns.vm        7 Aug 2003 21:27:46 -0000       1.2
  @@ -3,7 +3,11 @@
       #set ( $size = $col.printSize() )
       #set ( $default = $col.DefaultSetting )
       #set ( $nullString = $strings.select($col.isNotNull(), 
$dbprops.get("NOTNULL"),"") )
  -    #set ( $autoIncrement = $strings.select($col.isAutoIncrement(), 
$dbprops.get("AUTOINCREMENT"),"") )
  +    #if ($col.isAutoIncrement() && $table.IdMethod == "native")
  +      #set ( $autoIncrement = $dbprops.get("AUTOINCREMENT") )
  +    #else
  +      #set ( $autoIncrement = " " )
  +    #end    
       #set ( $entry = "$col.Name $type $size $autoIncrement," )
       $strings.sub($strings.collapseSpaces($entry)," ,",",")
   #end
  
  
  
  1.2       +5 -1      db-torque/src/generator/src/templates/sql/base/db2400/columns.vm
  
  Index: columns.vm
  ===================================================================
  RCS file: 
/home/cvs/db-torque/src/generator/src/templates/sql/base/db2400/columns.vm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- columns.vm        10 Feb 2003 13:18:47 -0000      1.1
  +++ columns.vm        7 Aug 2003 21:27:46 -0000       1.2
  @@ -2,7 +2,11 @@
       #set ( $type = $dbprops.get($col.Type) )
       #set ( $size = $col.printSize() )
       #set ( $default = $col.DefaultSetting )
  -    #set ( $autoIncrement = $strings.select($col.isAutoIncrement(), 
$dbprops.get("AUTOINCREMENT"),"") )
  +    #if ($col.isAutoIncrement() && $table.IdMethod == "native")
  +      #set ( $autoIncrement = $dbprops.get("AUTOINCREMENT") )
  +    #else
  +      #set ( $autoIncrement = " " )
  +    #end    
       #set ( $nullString = $strings.select($col.isNotNull(), 
$dbprops.get("NOTNULL"),"") )
       #set ( $entry = "$col.Name $type $size $default $nullString $autoIncrement," )
       $strings.sub($strings.collapseSpaces($entry)," ,",",")
  
  
  
  1.100     +5 -0      db-torque/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/db-torque/xdocs/changes.xml,v
  retrieving revision 1.99
  retrieving revision 1.100
  diff -u -r1.99 -r1.100
  --- changes.xml       5 Aug 2003 17:11:13 -0000       1.99
  +++ changes.xml       7 Aug 2003 21:27:46 -0000       1.100
  @@ -48,6 +48,11 @@
       <li>
         TRQS174: Problems on DB2 with BINARY, VARBINARY and INTEGER.
       </li>
  +    <li>
  +      TRQS178: use sql autoincrement only if idMethod native.<br/>
  +      So you have to set idMethod="native" (table) plus autoincrement="true" 
  +      (column) to generate the autoincrement code in your sql.
  +    </li>
     </ul>
   </p>
   </subsection>
  
  
  
  1.3       +5 -1      db-torque/src/generator/src/templates/sql/base/db2/columns.vm
  
  Index: columns.vm
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/templates/sql/base/db2/columns.vm,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- columns.vm        4 Aug 2003 23:20:28 -0000       1.2
  +++ columns.vm        7 Aug 2003 21:27:46 -0000       1.3
  @@ -7,7 +7,11 @@
       #set ( $rawsize = $col.Size )
       #set ( $torquetype = $col.TorqueType )
       #set ( $default = $col.DefaultSetting )
  -    #set ( $autoIncrement = $strings.select($col.isAutoIncrement(), 
$dbprops.get("AUTOINCREMENT"),"") )
  +    #if ($col.isAutoIncrement() && $table.IdMethod == "native")
  +      #set ( $autoIncrement = $dbprops.get("AUTOINCREMENT") )
  +    #else
  +      #set ( $autoIncrement = " " )
  +    #end    
       #set ( $nullString = $strings.select($col.isNotNull(), 
$dbprops.get("NOTNULL"),"") )
       #if ( $torquetype == "BINARY" )
           #set ( $entry = "$col.Name CHAR($rawsize) FOR BIT DATA $default $nullString 
$autoIncrement," )
  
  
  
  1.2       +5 -1      db-torque/src/generator/src/templates/sql/base/mssql/columns.vm
  
  Index: columns.vm
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/templates/sql/base/mssql/columns.vm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- columns.vm        10 Feb 2003 13:18:49 -0000      1.1
  +++ columns.vm        7 Aug 2003 21:27:46 -0000       1.2
  @@ -7,7 +7,11 @@
       #end
       #set ( $default = $col.DefaultSetting )
       #set ( $nullString = $strings.select($col.isNotNull(), 
$dbprops.get("NOTNULL"),$dbprops.get("NULL")) )
  -    #set ( $autoIncrement = $strings.select($col.isAutoIncrement(), 
$dbprops.get("AUTOINCREMENT"),"") )
  +    #if ($col.isAutoIncrement() && $table.IdMethod == "native")
  +      #set ( $autoIncrement = $dbprops.get("AUTOINCREMENT") )
  +    #else
  +      #set ( $autoIncrement = " " )
  +    #end    
       #set ( $entry = "$col.Name $type $size $default $nullString $autoIncrement," )
       $strings.sub($strings.collapseSpaces($entry)," ,",",")
   #end
  
  
  
  1.4       +5 -6      db-torque/src/generator/src/templates/sql/base/mysql/columns.vm
  
  Index: columns.vm
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/templates/sql/base/mysql/columns.vm,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- columns.vm        4 Aug 2003 23:25:39 -0000       1.3
  +++ columns.vm        7 Aug 2003 21:27:46 -0000       1.4
  @@ -7,12 +7,11 @@
        #end
       #set ( $default = $col.DefaultSetting )
       #set ( $nullString = $strings.select($col.isNotNull(), 
$dbprops.get("NOTNULL"),"") )
  -    #set ( $autoIncrement = $strings.select($col.isAutoIncrement(), 
$dbprops.get("AUTOINCREMENT"),"") )
  -    #if ($table.getIdMethod() == "native")
  -        #if ($col.isPrimaryKey() && ($col.Type == "INTEGER"))
  -            #set ( $autoIncrement = $dbprops.get("AUTOINCREMENT"))
  -        #end
  -    #end
  +    #if ($col.isAutoIncrement() && $table.IdMethod == "native")
  +      #set ( $autoIncrement = $dbprops.get("AUTOINCREMENT") )
  +    #else
  +      #set ( $autoIncrement = " " )
  +    #end    
       #set ( $entry = "$col.Name $type $size $default $nullString $autoIncrement," )
       $strings.sub($strings.collapseSpaces($entry)," ,",",")
   #end
  
  
  
  1.2       +5 -1      db-torque/src/generator/src/templates/sql/base/sybase/columns.vm
  
  Index: columns.vm
  ===================================================================
  RCS file: 
/home/cvs/db-torque/src/generator/src/templates/sql/base/sybase/columns.vm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- columns.vm        10 Feb 2003 13:18:44 -0000      1.1
  +++ columns.vm        7 Aug 2003 21:27:46 -0000       1.2
  @@ -15,7 +15,11 @@
       #else
          #set ( $nullString = $strings.select($col.isNotNull(), 
$dbprops.get("NOTNULL"),"NULL") )
       #end
  -    #set ( $autoIncrement = $strings.select($col.isAutoIncrement(), 
$dbprops.get("AUTOINCREMENT"),"") )
  +    #if ($col.isAutoIncrement() && $table.IdMethod == "native")
  +      #set ( $autoIncrement = $dbprops.get("AUTOINCREMENT") )
  +    #else
  +      #set ( $autoIncrement = " " )
  +    #end    
       #set ( $entry = "$col.Name $type $size $default $nullString $autoIncrement," )
       $strings.sub($strings.collapseSpaces($entry)," ,",",")
   #end
  
  
  
  1.15      +22 -0     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.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- test-schema.xml   29 Jun 2003 14:30:03 -0000      1.14
  +++ test-schema.xml   7 Aug 2003 21:27:46 -0000       1.15
  @@ -123,5 +123,27 @@
         <index-column name="invoice_id"/>
       </index>
     </table>
  +
  +  <!-- test for autoincrement -->
  +  <table name="AUTOINCREMENT_NATIVE" idMethod="native">
  +    <column name="AUTOINCREMENT_NATIVE_ID" required="true" primaryKey="true" 
type="INTEGER" autoIncrement="true"/>
  +    <column name="NAME" type="VARCHAR" size="250"/>
  +  </table>
  +  <table name="AUTOINCREMENT_NONE" idMethod="none">
  +    <column name="AUTOINCREMENT_NONE_ID" required="true" primaryKey="true" 
type="INTEGER" autoIncrement="true"/>
  +    <column name="NAME" type="VARCHAR" size="250"/>
  +  </table>
  +  <table name="AUTOINCREMENT_IDBROKER" idMethod="idBroker">
  +    <column name="AUTOINCREMENT_IDBROKER_ID" required="true" primaryKey="true" 
type="INTEGER" autoIncrement="true"/>
  +    <column name="NAME" type="VARCHAR" size="250"/>
  +  </table>
     
  +  <!-- TRQS87  -->
  +<!--  
  +  <table name="reserved_words">
  +    <column name="reserved_words_id" required="false" type="INTEGER"/>
  +    <column name="class" javaName="JavaClass" required="false" type="VARCHAR"/>
  +    <column name="package" javaName="JavaPackage" required="false" type="VARCHAR"/>
  +  </table>
  +-->  
   </database>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to