On Fri, Jul 3, 2015 at 1:43 PM, Stephan Beal <sgbeal at googlemail.com> wrote:

> On Fri, Jul 3, 2015 at 1:39 PM, Kumar Suraj <surajnitk at gmail.com> 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.
>

Minor elaboration:

the prepare() docs say:

https://www.sqlite.org/c3ref/prepare.html

"If pzTail is not NULL then *pzTail is made to point to the first byte past
the end of the first SQL statement in zSql. These routines only compile the
first statement in zSql, so *pzTail is left pointing to what remains
uncompiled."

so you're only compiling the BEGIN part of your statement, to which you
cannot bind() anything.


-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf

Reply via email to