Hello. I've encountered inconsistent behaviour with SQLite and wanted to get some clarification here.
sqlite3_bind_parameter_count returns incorrect count for an SQL with multiple statements(separated by semicolon)
CREATE TABLE IF NOT EXISTS test(id); INSERT INTO test VALUES(?); INSERT INTO test VALUES(?);
sqlite3_prepare_v2 and then
sqlite3_bind_parameter_count yields 0 parameter count, while it should be 2.
Is this intended behaviour? If so, how do I get the actual parameter count?
Is this intended behaviour?
Reread the docs for the prepare APIs. They only prepare single statements. Any statement after the first one is ignored.
More precisely, look at the last out param of
which tells you where SQLite stopped when preparing the 1st statement of your SQL script.
Which allows you to prepare the next statement in your script, and so on...
Thanks for replies. Should've read the docs more carefully.