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/generator/src/templates/sql/base/postgresql columns.vm
Date Fri, 05 Dec 2003 16:38:26 GMT
mpoeschl    2003/12/05 08:38:26

  Modified:    src/generator/src/templates/sql/base/postgresql columns.vm
  Log:
  formatting
  
  Revision  Changes    Path
  1.4       +38 -37    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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- columns.vm	25 Nov 2003 16:57:13 -0000	1.3
  +++ columns.vm	5 Dec 2003 16:38:26 -0000	1.4
  @@ -1,46 +1,47 @@
   #foreach ($col in $table.Columns)
  -    #if ($col.TorqueType.indexOf("BOOLEAN") != -1)
  -       #set ( $type = $dbprops.get($col.TorqueType) )
  -    #else
  -       #set ( $type = $dbprops.get($col.Type) )
  -    #end
  -    #if ($col.TorqueType.indexOf("INT") == -1)
  -        #set ( $size = $col.printSize() )
  -    #else
  -        #set ( $size = "" )
  -    #end
  -    #if (($table.IdMethod == "native") && ($col.isPrimaryKey()))
  -      #set ( $default = "DEFAULT nextval('$table.SequenceName')" )
  -    #else
  -      #set ( $default = $col.DefaultSetting )
  -    #end
  -    #set ( $entry = "$col.Name $type $size $default $col.NotNullString" )
  -    #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) )
  +  #if ($col.TorqueType.indexOf("BOOLEAN") != -1)
  +    #set ( $type = $dbprops.get($col.TorqueType) )
  +  #else
  +    #set ( $type = $dbprops.get($col.Type) )
  +  #end
  +  #if ($col.TorqueType.indexOf("INT") == -1)
  +    #set ( $size = $col.printSize() )
  +  #else
  +    #set ( $size = "" )
  +  #end
  +  #if (($table.IdMethod == "native") && ($col.isPrimaryKey()))
  +    #set ( $default = "DEFAULT nextval('$table.SequenceName')" )
  +  #else
  +    #set ( $default = $col.DefaultSetting )
  +  #end
  +  #set ( $entry = "$col.Name $type $size $default $col.NotNullString" )
  +  #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
   ## if you turn it on, be sure to comment out foreignkey.vm
  -#if (false)
  -  #if ($col.isForeignKey())
  -    #set ($fk = $col.ForeignKey)
  -    #set ($entry = "$entry REFERENCES $fk.ForeignTableName ($fk.ForeignColumnNames)")
  -    #if ($fk.hasOnUpdate())
  -      #set ($entry = "$entry ON UPDATE $fk.OnUpdate ")
  -    #end
  -    #if ($fk.hasOnDelete())
  -      #set ($entry = "$entry ON DELETE $fk.OnDelete ")
  +  #if (false)
  +    #if ($col.isForeignKey())
  +      #set ($fk = $col.ForeignKey)
  +      #set ($entry = "$entry REFERENCES $fk.ForeignTableName ($fk.ForeignColumnNames)")
  +      #if ($fk.hasOnUpdate())
  +        #set ($entry = "$entry ON UPDATE $fk.OnUpdate ")
  +      #end
  +      #if ($fk.hasOnDelete())
  +        #set ($entry = "$entry ON DELETE $fk.OnDelete ")
  +      #end
       #end
     #end
  -#end
  -## add a nice comment
  -#if ($col.isForeignKey())
  -  #set ($fk = $col.ForeignKey)
  +  ## add a nice comment
  +  #if ($col.isForeignKey())
  +    #set ($fk = $col.ForeignKey)
         -- REFERENCES $fk.ForeignTableName ($fk.ForeignColumnNames)
  -#end
  -#set ( $entry = $strings.collapseSpaces("$entry,") )
  +  #end
  +  #set ( $entry = $strings.collapseSpaces("$entry,") )
       $strings.sub($entry," ,",",")
   #end
  
  
  

---------------------------------------------------------------------
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