I applied most of your patch. I did not change the 1 to a 3 in table.vm
chop method as I can't test these changes and I was not sure what it was
supposed to accomplish. I think only a single character should be be
removed.
john mcnally
On Mon, 2002-04-08 at 06:40, Humberto Hernandez Torres wrote:
>
> Daniel, I hope this patchfile works better. The previous mail also had an
> attachment but it was overlaped on a forwarded message causing a confusion.
>
> Description of the fix:
> Changed the templates for MSSQL. The fields TEXT and INT shouldn�t have a
> size in MSSQL and handles the case when there is no primary key defined.
>
> --
> Humberto
> <<patchfile.txt>>
>
> ----
>
> Index: columns.vm
> ===================================================================
> RCS file:
>/home/cvspublic/jakarta-turbine-2/conf/torque/templates/sql/base/mssql/columns.vm,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 columns.vm
> --- columns.vm 16 Aug 2001 05:07:00 -0000 1.1.1.1
> +++ columns.vm 2 Apr 2002 17:22:13 -0000
> @@ -1,6 +1,9 @@
> #foreach ($col in $table.Columns)
> #set ( $type = $dbprops.get($col.Type) )
> #set ( $size = $col.printSize() )
> + #if ($type == "TEXT")
> + #set ( $size = "")
> + #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"),"") )
> Index: db.props
> ===================================================================
> RCS file:
>/home/cvspublic/jakarta-turbine-2/conf/torque/templates/sql/base/mssql/db.props,v
> retrieving revision 1.6
> diff -u -r1.6 db.props
> --- db.props 26 Jan 2002 01:57:32 -0000 1.6
> +++ db.props 2 Apr 2002 17:22:13 -0000
> @@ -8,7 +8,7 @@
> DOUBLE = FLOAT
> NUMERIC = NUMERIC
> DECIMAL = DECIMAL
> -CHAR = VARCHAR
> +CHAR = CHAR
> VARCHAR = VARCHAR
> LONGVARCHAR = TEXT
> DATE = DATETIME
> Index: primarykey.vm
> ===================================================================
> RCS file:
>/home/cvspublic/jakarta-turbine-2/conf/torque/templates/sql/base/mssql/primarykey.vm,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 primarykey.vm
> --- primarykey.vm 16 Aug 2001 05:07:00 -0000 1.1.1.1
> +++ primarykey.vm 2 Apr 2002 17:22:13 -0000
> @@ -1,2 +1,3 @@
> +#if ($table.hasPrimaryKey())
> CONSTRAINT ${table.Name}_PK PRIMARY KEY($table.printPrimaryKey()),
> -
> +#end
> Index: table.vm
> ===================================================================
> RCS file:
>/home/cvspublic/jakarta-turbine-2/conf/torque/templates/sql/base/mssql/table.vm,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 table.vm
> --- table.vm 16 Aug 2001 05:07:01 -0000 1.1.1.1
> +++ table.vm 2 Apr 2002 17:22:13 -0000
> @@ -9,7 +9,7 @@
> #set ( $cols = $generator.parse("$basepath/columns.vm", "", "table", $tbl) )
> #set ( $pk = $generator.parse("$basepath/primarykey.vm", "", "table", $tbl) )
> #set ( $unique = $generator.parse("$basepath/unique.vm", "", "table", $tbl) )
> -#if($strings.allEmpty([$pk,$unique]))$strings.chop($cols,1)#else$cols#end
> +#if($strings.allEmpty([$pk,$unique]))$strings.chop($cols,3)#else$cols#end
> #if($strings.allEmpty([$unique]) && $pk.length()>0)$strings.chop($pk,2)#else$pk#end
> #if($unique.length()>0)$strings.chop($unique,2)#end
> );
>
> ----
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>