John Siracusa wrote:
> >On 7/29/06 3:53 PM, Kurt Hansen wrote: > > >>package Basket; >>[...] >> relationships => [ >> persons => { >> type => 'one to many', >> class => 'Person', >> column_map => { Item => 'Item' }, >> }, >>[...] >>I'd enter one entry with a transaction_id=10 and Item=1 just fine. If I >>entered another entry with transaction_id=11 and Item=1, the previous >>entry in the "persons" table for transaction_id=10 would be deleted. >>This is because when the save() is executed, the SQL created issues a >>DELETE before the INSERT into "persons", e.g. >> >>DELETE FROM persons WHERE >> Item = ? - bind params: 1 >> >>I was very suprised by this DELETE. >> >> > >When you say "I'd enter one entry" and "I entered another entry", I'm >guessing that you mean this, in code: > > $b = Basket->new(...); > $p1 = Person->new(...); > $p2 = Person->new(...); > > $b->persons($p1); # "I'd enter one entry" > > $b->persons($p2); # "I entered another entry" > > Thanks very much for responding, John. It wasn't necessary, but it is helpful. However, that's not what I meant by enter another entry. Let me rearrange your example: $b1 = Basket->new(...); $p1 = Person->new(...); $b1->persons($p1); $b1->save(); # "I'd enter one entry" $b2 = Basket->new(...); $p2 = Person->new(...); $b2->persons($p2); $b2->save(); # "I entered another entry" This would result in the $p1 data being deleted. In both saves, a DELETE was called before the INSERT into persons. Wouldn't expect that, but that's probably because I didn't understand it well enough. Take care, Kurt ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Rose-db-object mailing list Rose-db-object@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rose-db-object