You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by Walt Armour <Wa...@concur.com> on 2003/03/11 20:52:51 UTC

UPDATE and criteria across multiple tables

I'm looking at implementing a patch for the hugely inefficient way Torque
does updates and deletes (this has been discussed previously on the list and
a patch against an older Torque was posted by cfelaco@netscape.net).

I've found something that I consider highly odd in the code and was hoping
someone could tell me the reasoning behind it (otherwise it's getting
yanked).

In BasePeer.doUpdate() it builds up a list of tables and loops, performing a
select/update cycle for each table mentioned in the select criteria (not the
update values criteria).  Looking at the way the code is implemented it
appears that if anyone actually used this functionality they could really
hurt themselves.

A SQL update can only affect one table.  However, the where clause can
reference multiple tables but there still would only be a single table
updated.

So, boils down to this: why is this functionality in there?  I can't think
of any valid way to use it from a criteria standpoint nor can I think of a
valid SQL equivalent that would yield updates to multiple tables with a
single statement.