[sqlite] insert in sqlite (returning value for inserted row)

2015-04-01 Thread R.Smith
On 2015-04-01 07:10 PM, Kumar Suraj wrote: > Hi Richard.. this wont work for me due to following reason. > > If a separate thread performs a new INSERT > on the same database connection > while the sqlite3_last_insert_rowid() >

[sqlite] insert in sqlite (returning value for inserted row)

2015-04-01 Thread Doug Currie
Suraj, Don't use the same database connection in multiple threads. Each thread should use its own connection. Then last insert rowid is predictable. e On Wed, Apr 1, 2015 at 1:10 PM, Kumar Suraj wrote: > Hi Richard.. this wont work for me due to following reason. > > If a separate thread perf

[sqlite] insert in sqlite (returning value for inserted row)

2015-04-01 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 04/01/2015 10:10 AM, Kumar Suraj wrote: > Hi Richard.. this wont work for me due to following reason. Yes it will. This is how I do it: BEGIN TRANSACTION; INSERT INTO table .; SELECT last_insert_rowid(); COMMIT; That will always

[sqlite] insert in sqlite (returning value for inserted row)

2015-04-01 Thread Kumar Suraj
Hi Richard.. this wont work for me due to following reason. If a separate thread performs a new INSERT on the same database connection while the sqlite3_last_insert_rowid() function is running and thus

[sqlite] insert in sqlite (returning value for inserted row)

2015-04-01 Thread Simon Slavin
On 1 Apr 2015, at 2:19am, Kumar Suraj wrote: > I am using sqlite C interface for inserting data in the table. The primary > key is a 64 bit integer which i need to auto-increment and get populated > automatically as we do not provide that value in insert statement. Is there > a way i can get the

[sqlite] insert in sqlite (returning value for inserted row)

2015-03-31 Thread Richard Hipp
https://www.sqlite.org/c3ref/last_insert_rowid.html On Tue, Mar 31, 2015 at 9:19 PM, Kumar Suraj wrote: > Hi > > I am using sqlite C interface for inserting data in the table. The primary > key is a 64 bit integer which i need to auto-increment and get populated > automatically as we do not prov

[sqlite] insert in sqlite (returning value for inserted row)

2015-03-31 Thread Keith Medcalf
] insert in sqlite (returning value for inserted row) > > >On 1 Apr 2015, at 2:19am, Kumar Suraj wrote: > >> I am using sqlite C interface for inserting data in the table. The >primary >> key is a 64 bit integer which i need to auto-increment and get >populated >> a

[sqlite] insert in sqlite (returning value for inserted row)

2015-03-31 Thread Kumar Suraj
Hi I am using sqlite C interface for inserting data in the table. The primary key is a 64 bit integer which i need to auto-increment and get populated automatically as we do not provide that value in insert statement. Is there a way i can get the autoincremented value for each row inserted when ev