Re: [sqlite] INSERTing a row only if it doesn't EXIST

2005-09-17 Thread Puneet Kishor
On Sep 17, 2005, at 4:35 PM, Alexander J. Kozlovsky wrote: I want to avoid doing a two step process outside the db... I want to insert a row only if it doesn't exist already. IMHO, if you table T1 have a unique key, you may do this INSERT OR IGNORE T1 VALUES(1, 2, 3); ahhh! the conflict

Re: [sqlite] INSERTing a row only if it doesn't EXIST

2005-09-17 Thread Kurt Welgehausen
If id in your example identifies a row, then by definition it is unique (probably the primary key). If you try to insert another row with the same id, the insert will fail. Why not just catch the exception or error code? Regards

Re: [sqlite] INSERTing a row only if it doesn't EXIST

2005-09-17 Thread Alexander J. Kozlovsky
> I want to avoid doing a two step process outside the db... I want to > insert a row only if it doesn't exist already. IMHO, if you table T1 have a unique key, you may do this INSERT OR IGNORE T1 VALUES(1, 2, 3); Best regards, Alexandermailto:[EMAIL PROTECTED]

[sqlite] INSERTing a row only if it doesn't EXIST

2005-09-17 Thread Puneet Kishor
I want to avoid doing a two step process outside the db... I want to insert a row only if it doesn't exist already. REPLACE INTO seems to almost do the trick, however, seems like it will UPDATE if the row already exists. I want the row to be left alone if it exists. Am trying to figure out if