[sqlite] error during bind

2015-07-06 Thread Kumar Suraj
Thanks a lot .. this helped.. On Fri, Jul 3, 2015 at 10:16 PM, Simon Slavin wrote: > > On 3 Jul 2015, at 5:16pm, Kumar Suraj wrote: > > > So whats the solution here. I am giving 4 statements because i need > insert > > to be transactional. Some other process could be inserting in the same db >

[sqlite] error during bind

2015-07-03 Thread Kumar Suraj
Hi So whats the solution here. I am giving 4 statements because i need insert to be transactional. Some other process could be inserting in the same db and so we need insert and row id values to be in one transaction. Is there any other way i can achieve it. -Suraj On Fri, Jul 3, 2015 at 5:13

[sqlite] error during bind

2015-07-03 Thread Stephan Beal
On Fri, Jul 3, 2015 at 6:16 PM, Kumar Suraj wrote: > So whats the solution here. I am giving 4 statements because i need insert > to be transactional. You need to prepare() 4 statements or, like Clemens suggests, use exec() where possible instead of prepare/step. Some other process could be

[sqlite] error during bind

2015-07-03 Thread Simon Slavin
On 3 Jul 2015, at 5:16pm, Kumar Suraj wrote: > So whats the solution here. I am giving 4 statements because i need insert > to be transactional. Some other process could be inserting in the same db > and so we need insert and row id values to be in one transaction. Is there > any other way i

[sqlite] error during bind

2015-07-03 Thread Kumar Suraj
Hi I have trying to insert in a sqlite db.. here is the code but i am getting following error.. what could be the issue. *Error Insert : sqlite3_bind_blob, Error code : 25* #define INSERT_DN "BEGIN TRANSACTION; INSERT INTO TBL (dn) VALUES (?); SELECT last_insert_rowid(); COMMIT;" BinBuffer

[sqlite] error during bind

2015-07-03 Thread Clemens Ladisch
Kumar Suraj wrote: > BEGIN TRANSACTION; INSERT INTO TBL (dn) VALUES (?); SELECT > last_insert_rowid(); COMMIT; Please note that the value returned by the SQL function "last_insert_rowid()" is also available with the C API function "sqlite3_last_insert_rowid(db)". When you have SQL commands

[sqlite] error during bind

2015-07-03 Thread Stephan Beal
On Fri, Jul 3, 2015 at 1:43 PM, Stephan Beal wrote: > On Fri, Jul 3, 2015 at 1:39 PM, Kumar Suraj wrote: > >> #define INSERT_DN "BEGIN TRANSACTION; INSERT INTO TBL (dn) VALUES (?); >> SELECT last_insert_rowid(); COMMIT;" >> >> > prepare() expects a _single_ statement. You're giving it 4

[sqlite] error during bind

2015-07-03 Thread Stephan Beal
On Fri, Jul 3, 2015 at 1:39 PM, Kumar Suraj wrote: > #define INSERT_DN "BEGIN TRANSACTION; INSERT INTO TBL (dn) VALUES (?); > SELECT last_insert_rowid(); COMMIT;" > > prepare() expects a _single_ statement. You're giving it 4 statements and then trying to bind to part of that, which won't work.