jmcnally 02/05/20 10:55:15
Modified: src/templates/sql/base/mssql columns.vm db.props
primarykey.vm
src/templates/sql/base/sybase columns.vm db.props
primarykey.vm
Log:
Some patches by Humberto Hernandez Torres <[EMAIL PROTECTED]> submitted
for the mssql templates and applied by me to the sybase templates as well, to
1. not add size info to TEXT (and INT) column types
2. handle tables with no pk's
3. use CHAR for CHAR jdbc type
I also added a maxColumnLength=30 property and filled in some of the empty types
in db.props for sybase, based on what was in mssql. I did not change anything
that was in disagreement between the two.
Revision Changes Path
1.2 +5 -1 jakarta-turbine-torque/src/templates/sql/base/mssql/columns.vm
Index: columns.vm
===================================================================
RCS file: /home/cvs/jakarta-turbine-torque/src/templates/sql/base/mssql/columns.vm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- columns.vm 2 Aug 2001 05:08:40 -0000 1.1
+++ columns.vm 20 May 2002 17:55:15 -0000 1.2
@@ -1,6 +1,10 @@
#foreach ($col in $table.Columns)
#set ( $type = $dbprops.get($col.Type) )
- #set ( $size = $col.printSize() )
+ #if ($type == "INT" || $type == "TEXT")
+ #set ( $size = "" )
+ #else
+ #set ( $size = $col.printSize() )
+ #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"),"") )
1.7 +2 -2 jakarta-turbine-torque/src/templates/sql/base/mssql/db.props
Index: db.props
===================================================================
RCS file: /home/cvs/jakarta-turbine-torque/src/templates/sql/base/mssql/db.props,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- db.props 26 Jan 2002 01:56:59 -0000 1.6
+++ db.props 20 May 2002 17:55:15 -0000 1.7
@@ -8,7 +8,7 @@
DOUBLE = FLOAT
NUMERIC = NUMERIC
DECIMAL = DECIMAL
-CHAR = VARCHAR
+CHAR = CHAR
VARCHAR = VARCHAR
LONGVARCHAR = TEXT
DATE = DATETIME
@@ -31,5 +31,5 @@
NOTNULL = NOT NULL
removeNotNullWithAutoIncrement = false
-
suppressDefaults = false
+maxColumnNameLength = 30
1.2 +2 -1
jakarta-turbine-torque/src/templates/sql/base/mssql/primarykey.vm
Index: primarykey.vm
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/templates/sql/base/mssql/primarykey.vm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- primarykey.vm 2 Aug 2001 05:08:40 -0000 1.1
+++ primarykey.vm 20 May 2002 17:55:15 -0000 1.2
@@ -1,2 +1,3 @@
+#if ($table.hasPrimaryKey())
CONSTRAINT ${table.Name}_PK PRIMARY KEY($table.printPrimaryKey()),
-
+#end
\ No newline at end of file
1.3 +5 -1 jakarta-turbine-torque/src/templates/sql/base/sybase/columns.vm
Index: columns.vm
===================================================================
RCS file: /home/cvs/jakarta-turbine-torque/src/templates/sql/base/sybase/columns.vm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- columns.vm 24 Oct 2001 01:19:55 -0000 1.2
+++ columns.vm 20 May 2002 17:55:15 -0000 1.3
@@ -1,6 +1,10 @@
#foreach ($col in $table.Columns)
#set ( $type = $dbprops.get($col.Type) )
- #set ( $size = $col.printSize() )
+ #if ($type == "INT" || $type == "TEXT")
+ #set ( $size = "" )
+ #else
+ #set ( $size = $col.printSize() )
+ #end
#if ( $dbprops.get("suppressDefaults") == "true" )
#set ( $default = "" )
#else
1.2 +9 -7 jakarta-turbine-torque/src/templates/sql/base/sybase/db.props
Index: db.props
===================================================================
RCS file: /home/cvs/jakarta-turbine-torque/src/templates/sql/base/sybase/db.props,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- db.props 2 Aug 2001 05:08:40 -0000 1.1
+++ db.props 20 May 2002 17:55:15 -0000 1.2
@@ -2,15 +2,15 @@
# JDBC to Sybase mappings.
BIT = BIT
-TINYINT =
-SMALLINT =
+TINYINT = TINYINT
+SMALLINT = SMALLINT
INTEGER = INT
-BIGINT =
-FLOAT =
-REAL =
-DOUBLE =
+BIGINT = BIGINT
+FLOAT = FLOAT
+REAL = REAL
+DOUBLE = FLOAT
NUMERIC = NUMERIC
-DECIMAL =
+DECIMAL = DECIMAL
CHAR = CHAR
VARCHAR = VARCHAR
LONGVARCHAR = TEXT
@@ -64,4 +64,6 @@
# Default: NOT NULL
#
NOTNULL = NOT NULL
+
+maxColumnNameLength = 30
1.2 +2 -0
jakarta-turbine-torque/src/templates/sql/base/sybase/primarykey.vm
Index: primarykey.vm
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/templates/sql/base/sybase/primarykey.vm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- primarykey.vm 2 Aug 2001 05:08:40 -0000 1.1
+++ primarykey.vm 20 May 2002 17:55:15 -0000 1.2
@@ -1 +1,3 @@
+#if ($table.hasPrimaryKey())
CONSTRAINT ${table.Name}_PK PRIMARY KEY($table.printPrimaryKey()),
+#end
\ No newline at end of file
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>