I believe I've found a fairly simple solution to this problem. Please
let me know if this makes sense.
The inserts into ID_TABLE are done with templates found in the
"WEB-INF\build\bin\torque\templates\sql\id-table" directory. There is a
different file in this directory for every target database vendor and
they are named "idtable.<vendor_name>". Almost all of these templates
are exactly alike -- their contents are like so (indented for clarity):
### start idtable.oracle ###
delete from ID_TABLE where id_table_id >= $initialID;
#foreach ($tbl in $tables)
insert into ID_TABLE (id_table_id, table_name, next_id, quantity)
VALUES ($initialID, '$tbl.Name', 100, 10);
#set ( $initialID = $initialID + 1 )
#end
### end idtable.oracle ###
Perhaps we can simply put a check inside the foreach ensuring the table
is not an alias before writing the insert (indented for clarity):
### start NEW idtable.oracle ###
delete from ID_TABLE where id_table_id >= $initialID;
#foreach ($tbl in $tables)
#if (!$tbl.isAlias())
insert into ID_TABLE (id_table_id, table_name, next_id,
quantity) VALUES ($initialID, '$tbl.Name', 100, 10);
#set ( $initialID = $initialID + 1 )
#end
#end
### end NEW idtable.oracle ###
Does this feel right?
+jeff
> -----Original Message-----
> From: John McNally [mailto:[EMAIL PROTECTED]]
> Sent: Mon, 13 May 2002 12:44:50 -0700
> To: 'Turbine Torque Users List'
> Subject: extending user [was RE: ant init error messages]
>
>
> > -----Original Message-----
> > From: Jeff Barrett [[EMAIL PROTECTED]]
> > Sent: Mon 5/13/2002 12:34 PM
> > To: Turbine Users List
> > Subject: RE: ant init error messages
> >
> > On Mon, 2002-05-13 at 12:34, Jeff Barrett wrote:
> >
> >
> > That's spot on.
> >
> > There is one other bit as well: it seems the alias table entry in
> > <project_name>-schema.xml causes an insert to be placed into
> > <project_name>-id-table-init.sql with a table_name of the
> alias. As an
> > example, the TURINE_USER extension/aliasing we are
> discussing generates:
> >
> > insert into ID_TABLE (id_table_id, table_name, next_id,
> quantity) VALUES
> > (101, 'TURBINE_USER', 100, 10);
> >
> > This is problematic for two reasons:
> > 1) the following line is in turbine-id-table-init.sql and
> is executed
> > before the above line:
> > insert into ID_TABLE (id_table_id, table_name, next_id,
> quantity) VALUES
> > (5, 'TURBINE_USER', 100, 10);
> >
> > 2) there is (rightly) a unique constraint on the ID_TABLE.TABLE_NAME
> > column.
> >
> > It seems that an alias table entry in
> <project_name>-schema.xml should
> > not generate a new row insertion in
> <project_name>-id-table-init.sql and
> > thereby into ID_TABLE as the _actual_ table the alias
> refers to would
> > take care of that.
> >
> > Is there something we're missing in our configuration to prevent the
> > table alias from generating a new entry in
> > <project_name>-id-table-init.sql? Have I managed to
> completely confuse
> > everyone? (Incidently we realize this failed insert isn't causing a
> > problem, but error messages make us nervous.)
>
> The entry for the alias xml should not happen. It is likely a missing
> conditional in a template. Help tracking it down is appreciated.
>
> >
> > I also took a look at the change in the extended user
> howto. It looks
> > the alias table name is now TURBINE_USER but the foreign-key
> > foreignTable reference is still NEWAPP_USER. I believe this is
> > incorrect (although I've succeeded in confusing myself a bit now).
>
> Sorry missed that, it should be TURBINE_USER as well.
>
> john mcnally
>
>
> >
> >
> > Much thanks for the help,
> > +jeff
> >
> > -----Original Message-----
> > From: John McNally [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, May 13, 2002 10:26 AM
> > To: Turbine Users List
> > Subject: RE: ant init error messages
> >
> >
> > I have not followed the details of this thread, but from
> what I can tell
> > the extend-user-howto contained an error and the alias table entry
> > should refer to the actual table name TURBINE_USER not
> NEWAPP_USER. I
> > made the change in the doc. Was there something else that I missed?
> >
> > john mcnally
> >
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>