Are any of the Turbine or Torque Developers out there who can comment on
this?

-----Original Message-----
From: Scott Eade [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 09, 2002 2:03 PM
To: turbine-user
Subject: Re: ant init error messages


> From: "Jeff Barrett" <[EMAIL PROTECTED]>
> 
> It sounds like the SQL generation of foreign key constraints in schema
> xml files is wonky.
> 
> Specifically: when the foreign-key's attribute foreignTable refers to
a
> table alias, it's not finding the real table name and substituting it
> into the "ALTER TABLE" sql.
> 
> Do I have a correct understanding of the problem?
> 
> +jeff
> 
I think that about sums it up.

The problem is that
WEB-INF\build\bin\torque\templates\sql\base\mysql\foreignkey.vm
And the variants for the other databases use $fk,ForeignTableName
without
checking to see if it is an alias for another table (the name of which
should then be substituted in its place).

Producing a fix is hampered not only by my incomplete knowledge of how
this
works ;-), but also because it seems that the fact that ForeignTableName
is
an alias is not available within foreignkey.vm.

I am thinking that the solution will require some additional processing
back
in \WEB-INF\build\bin\torque\templates\data\Control.vm to look through
all
of the ForeignTableName values for all Tables, check the Table entry
that
represents that indicated by ForeignTableName and substitute Table.Alias
for
ForeignTableName when Table.isAlias() is true.

For this solution to work it will be necessary to go
$table.setForeignTableName($foreignTable.Alias) - is this set method
even
available?  An alternative would be to pass an additional List to
foreignKey.vm containing tableName, tableNameAlias pairs.

Can someone that is more familiar with this code confirm my logic?

Cheers,

Scott


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

Reply via email to