db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Eade <se...@backstagetech.com.au>
Subject Re: Documentation and (slightly) strange update problem
Date Wed, 25 Feb 2004 12:57:07 GMT
raph@mankin.org.uk wrote:

>As a newcomer to Torque, I would add that the lack of comprehensive
>documentation has been my biggest difficulty. Is there a documentation project
>in hand? I think that such a project should even take precedece over fixing
>bugs; if one at least has the wrinkles documented one can work around them, and
>AFAICT most are not major.
>
Everyone is welcome to contribute documentation.  Send it to this list, 
the torque-dev list or add it to the wiki.

>
>To move on ... I encountered some unintuitive behaviour when doing an update.
>
>
>I have a m:n join table. It looks something like
>
>        create table link (
>                PK integer auto_increment,      -- synthetic primary key
>                parent integer references mastertable,
>                child  integer references mastertable
>        )
>
>Now, I wanted to move a child from one parent to a different parent i.e. just
>update the 'parent' field in the link. I therefore selected on the
>(parent,child) pair, amended the parent value and called save(). This is where
>things went wrong.
>
>Torque tried to save using the same criteria that it had used to select, but I
>had changed one of the values. It therefore did an INSERT instead of an UPDATE
>when what I wanted was that it should do an UPDATE using the primary key.
>
>The actual behaviour is clearly the intended behaviour. What I am questioning
>is whether this is the correct behaviour. As we know from recent  postings,
>every table must have a primary key otherwise save() does not save. Given that
>there always is a primary key, should all UPDATEs *always* use that key and not
>the selection criteria?
>
>I worked around my problem, but good documentation would have made life much
>easier.
>
Please post the relevant schema and code.

Scott

-- 
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message