I checked in your patch to drop.vm, thanks.
The problem with the id_table will take some thought. The easiest
solution would be to declare
the TABLE_NAME column as the pk and eliminate the integer. Though it is
generally a bad idea to
use columns with other meaning as the pk, there are no foreign keys to
the id_table.
john mcnally
Age Mooy wrote:
>
> Hi,
>
> I found a bug in the code generation to oracle sql in the latest TDK
>
> The two velocity templates that deal with sequences (sequence.vm and drop.vm) are
>generating conflicting code.
> John McNally changed sequence.vm a few weeks ago but it seems he forgot to update
>drop.vm. Now the generated
> sql tries to drop a sequence that doesn't necessarily exist because the drop
>sequence and create sequence
> statements use two different naming conventions that don't always match. The drop.vm
>template takes the name
> of the table and adds '_SEQ' to it while the sequence.vm template uses
>$table.SequenceName. So if the source
> schema file defines a sequence with a non-generic name the generated code will fail.
>this also affect xml
> schema files that don't define their id method as 'sequence' but do have one or more
>auto-increment columns.
>
> I guess the obvious patch is to do the same thing to the drop.vm that John did to
>the sequence.vm file... so
> that is the one attached below.
>
> But this does lead to a possible issue with the id-table-schema.xml file... the
>ID_TABLE_ID PK column is set
> to auto-increment but with the change made by John Torque doesn't generate a
>sequence during oracle sql
> generation. I have never actively used the id generation service but that doesn't
>seem correct.
>
> John's log message for the change on sequence.vm was:
>
> "sequence creation should not be dependent on declaring a column to be
> autoincrement.If the idMethod is set to sequence, a sequence is needed."
>
> But that leads to the issue with the id-table-schema... what to do ?
>
> So the below patch makes the Torque Oracle code behave consistently but I don't know
>if that behavour is
> desired.... John ??
>
> Regards,
> Age
>
> Index: drop.vm
> ===================================================================
> RCS file:
>/home/cvspublic/jakarta-turbine/conf/torque/templates/sql/base/oracle/drop.vm,v
> retrieving revision 1.1
> diff -u -r1.1 drop.vm
> --- drop.vm 2000/11/30 22:08:31 1.1
> +++ drop.vm 2001/05/16 20:54:38
> @@ -1,6 +1,4 @@
> drop table $table.Name cascade constraints;
> -#foreach ($col in $table.Columns)
> -#if ($col.isAutoIncrement())
> -drop sequence ${table.Name}_SEQ;
> -#end
> +#if ($table.IdMethod == "sequence")
> +drop sequence $table.SequenceName;
> #end
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]