Re: [sqlite] Triggers & last_inserted_id

2004-06-07 Thread Dennis Cote
Pix wrote: > Suppose I've some tables like these: > > CREATE TABLE contacts (ID, name, surname); > CREATE TABLE oldContacts (ID, name, surname); > CREATE TABLE messages (message, contactID, contactWasDeleted default > NULL); > > I wrote a trigger similar to this: > > CREATE TRIGGER OnDeleteContact

Re: [sqlite] Triggers & last_inserted_id

2004-06-03 Thread Darren Duncan
At 10:53 AM +0200 6/3/04, Pix wrote: No... I need the id of the row inserted by the TRIGGER... the trigger operations should be atomic, so no other db activity should be a problem... I still don't think you need last_insert_id. Try this in your trigger: INSERT INTO OldContacts (ID, name,

Re: [sqlite] Triggers & last_inserted_id

2004-06-02 Thread Darren Duncan
At 5:38 PM +0200 6/2/04, Pix wrote: There is a way to have the right last_inserted_rowid() ? Don't use it. Instead, try substituting the string "old.id" for "last_insert_rowid()". You already know what the contact id is because its in "old.id". Moreover, "last_insert_rowid()" is completely

[sqlite] Triggers & last_inserted_id

2004-06-02 Thread Pix
Suppose I've some tables like these: CREATE TABLE contacts (ID, name, surname); CREATE TABLE oldContacts (ID, name, surname); CREATE TABLE messages (message, contactID, contactWasDeleted default NULL); I wrote a trigger similar to this: CREATE TRIGGER OnDeleteContact BEFORE DELETE ON Contacts FOR