Re: [sqlite] Last ID from Primary Key through ODBC
On 3/4/07, Christian Werner <[EMAIL PROTECTED]> wrote: Dan Kennedy wrote: > > On Sat, 2007-03-03 at 19:18 -0500, Mitchell Vincent wrote: > > I found the nifty ODBC driver for SQLite and have been trying to use > > it to replace a 2.8 SQlite implementation in some desktop software. > > It's working very well except for a rather large problem of not being > > able to call the last_id API functions. I need to get the primary keys > > assigned to parent tables in order to preserve referential integrity. > > > > SELECT MAX(id) FROM TABLE is one option but it's pretty dangerous > > seeing as multipl people *could* be accessing this database file at > > the same time.. > > What if you wrap the INSERT and "SELECT MAX(id)" statements together > in a transaction? Or what about issuing a "SELECT last_insert_rowid()" ? As long as it was inside a transaction (and that works), that's the ticket! Thanks! -- - Mitchell Vincent - K Software - Innovative Software Solutions - Visit our website and check out our great software! - http://www.ksoftware.net - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Last ID from Primary Key through ODBC
Dan Kennedy wrote: > > On Sat, 2007-03-03 at 19:18 -0500, Mitchell Vincent wrote: > > I found the nifty ODBC driver for SQLite and have been trying to use > > it to replace a 2.8 SQlite implementation in some desktop software. > > It's working very well except for a rather large problem of not being > > able to call the last_id API functions. I need to get the primary keys > > assigned to parent tables in order to preserve referential integrity. > > > > SELECT MAX(id) FROM TABLE is one option but it's pretty dangerous > > seeing as multipl people *could* be accessing this database file at > > the same time.. > > What if you wrap the INSERT and "SELECT MAX(id)" statements together > in a transaction? Or what about issuing a "SELECT last_insert_rowid()" ? Regards, Christian - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Last ID from Primary Key through ODBC
I really don't know. Will it work the way I think it will? :-) On 3/3/07, Dan Kennedy <[EMAIL PROTECTED]> wrote: On Sat, 2007-03-03 at 19:18 -0500, Mitchell Vincent wrote: > I found the nifty ODBC driver for SQLite and have been trying to use > it to replace a 2.8 SQlite implementation in some desktop software. > It's working very well except for a rather large problem of not being > able to call the last_id API functions. I need to get the primary keys > assigned to parent tables in order to preserve referential integrity. > > SELECT MAX(id) FROM TABLE is one option but it's pretty dangerous > seeing as multipl people *could* be accessing this database file at > the same time.. What if you wrap the INSERT and "SELECT MAX(id)" statements together in a transaction? > > Are there alternatives? > > Thanks! > - To unsubscribe, send email to [EMAIL PROTECTED] - -- - Mitchell Vincent - K Software - Innovative Software Solutions - Visit our website and check out our great software! - http://www.ksoftware.net - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Last ID from Primary Key through ODBC
On Sat, 2007-03-03 at 19:18 -0500, Mitchell Vincent wrote: > I found the nifty ODBC driver for SQLite and have been trying to use > it to replace a 2.8 SQlite implementation in some desktop software. > It's working very well except for a rather large problem of not being > able to call the last_id API functions. I need to get the primary keys > assigned to parent tables in order to preserve referential integrity. > > SELECT MAX(id) FROM TABLE is one option but it's pretty dangerous > seeing as multipl people *could* be accessing this database file at > the same time.. What if you wrap the INSERT and "SELECT MAX(id)" statements together in a transaction? > > Are there alternatives? > > Thanks! > - To unsubscribe, send email to [EMAIL PROTECTED] -