SQLite Forum

sqlite3_sql return value
Login

sqlite3_sql return value

(1) By anonymous on 2021-09-23 10:55:52 [link]

I am on the wal2 branch.

prepare with this sql:

"
REPLACE INTO tab1 VALUES(abs(random() % 100));
REPLACE INTO tab1 VALUES(abs(random() % 100));
REPLACE INTO tab1 VALUES(abs(random() % 100));
REPLACE INTO tab1 VALUES(abs(random() % 100));
REPLACE INTO tab1 VALUES(abs(random() % 100));
"

sqlite3_sql only return this:

"
REPLACE INTO tab1 VALUES(abs(random() % 100));
"

Is this correct ?  how I can get the full SQL related with the stmt ?

(2) By Larry Brasfield (larrybr) on 2021-09-23 11:06:28 in reply to 1

You may have noticed a parameter, pzTail, in the sqlite3_prepare() signatures. The prepare operation only operates upon one SQL statement at a time, but if you ask for it (by setting the pzTail pointer to reference a char *), the prepare will let you know where the remainder of your submitted string begins.

What you see is correct. See [the prepare doc](https://sqlite.org/c3ref/prepare.html).