Re: [sqlite] UNIQUE constraint on column

2007-02-04 Thread drh
"A. Pagaltzis" <[EMAIL PROTECTED]> wrote: > It's a pity that INSERT OR IGNORE (apparently?) does not set > last_insert_id properly regardless of outcome, Consider this case: CREATE TABLE t1(x INTEGER PRIMARY KEY, y UNIQUE, z UNIQUE); INSERT INTO t1 VALUES(1,'a','b'); INSERT INTO t1

Re: [sqlite] UNIQUE constraint on column

2007-02-01 Thread Shane Harrelson
"Shane Harrelson" <[EMAIL PROTECTED]> wrote: > > I have two tables, an "Objects" table with a foreign key into a second > "Strings" table which is composed of unique values. It is a many to > one relationship, that is, several Objects may reference the same > String. When an Object is added,

Re: [sqlite] UNIQUE constraint on column

2007-01-31 Thread drh
"Shane Harrelson" <[EMAIL PROTECTED]> wrote: > > I have two tables, an "Objects" table with a foreign key into a second > "Strings" table which is composed of unique values. It is a many to > one relationship, that is, several Objects may reference the same > String. When an Object is added,

Re: [sqlite] UNIQUE constraint on column

2007-01-31 Thread Nicolas Williams
On Wed, Jan 31, 2007 at 05:23:29PM -0500, Shane Harrelson wrote: > > I have two tables, an "Objects" table with a foreign key into a second > "Strings" table which is composed of unique values. It is a many to > one relationship, that is, several Objects may reference the same > String. When

Re: [sqlite] UNIQUE constraint on column

2007-01-31 Thread Shane Harrelson
On 1/31/07, Dennis Cote <[EMAIL PROTECTED]> wrote: Shane Harrelson wrote: > On 1/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> >> The official way to find the conflicting entry is to do a query. >> >> SELECT rowid FROM table WHERE uniquecolumn=?; >> >> > > Thank you for the reply. I

Re: [sqlite] UNIQUE constraint on column

2007-01-31 Thread Kees Nuyt
Hi Shane, On Wed, 31 Jan 2007 09:29:24 -0500, you wrote: >On 1/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> "Shane Harrelson" <[EMAIL PROTECTED]> wrote: >> > when i try to insert a row into a table that has a UNIQUE constraint >> > on a column, and I get the SQLITE_CONSTRAINT result

Re: [sqlite] UNIQUE constraint on column

2007-01-31 Thread Dennis Cote
Shane Harrelson wrote: On 1/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: The official way to find the conflicting entry is to do a query. SELECT rowid FROM table WHERE uniquecolumn=?; Thank you for the reply. I assumed this was most likely the case, and as I said in my original

Re: [sqlite] UNIQUE constraint on column

2007-01-31 Thread Shane Harrelson
On 1/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: "Shane Harrelson" <[EMAIL PROTECTED]> wrote: > when i try to insert a row into a table that has a UNIQUE constraint > on a column, and I get the SQLITE_CONSTRAINT result code because i'm > inserting a duplicate value, is there anyway to

Re: [sqlite] UNIQUE constraint on column

2007-01-31 Thread drh
"Shane Harrelson" <[EMAIL PROTECTED]> wrote: > when i try to insert a row into a table that has a UNIQUE constraint > on a column, and I get the SQLITE_CONSTRAINT result code because i'm > inserting a duplicate value, is there anyway to determine the rowid of > the conflict? > > looking at the

[sqlite] UNIQUE constraint on column

2007-01-31 Thread Shane Harrelson
when i try to insert a row into a table that has a UNIQUE constraint on a column, and I get the SQLITE_CONSTRAINT result code because i'm inserting a duplicate value, is there anyway to determine the rowid of the conflict? looking at the internals of the VDBE, i found that the rowid of the

[sqlite] UNIQUE constraint on column

2007-01-30 Thread Shane Harrelson
when i try to insert a row into a table that has a UNIQUE constraint on a column, and I get the SQLITE_CONSTRAINT result code because i'm inserting a duplicate value, is there anyway to determine the rowid of the conflict? looking at the internals of the VDBE, i found that the rowid of the