SQLite Forum

sqlite3_exec
Login

sqlite3_exec

(1) By anonymous on 2021-09-23 15:26:41 [source]

If I have 2 or more SQL statements which I execute with sqlite3_exec, it will execute the first statement.

  • what is the simplest way to move to the second and subsequent statements
  • is that done in the callback function?

(2) By Larry Brasfield (larrybr) on 2021-09-23 15:35:40 in reply to 1 [link] [source]

If you insist on combining SQL statements into a single string:
Look carefully at the sqlite3_prepare() family of APIs, in particular at the pzTail parameter and its effect.

Otherwise, put your SQL statements into separate strings.

(3) By Keith Medcalf (kmedcalf) on 2021-09-23 22:06:30 in reply to 1 [link] [source]

sqlite3_exec is a crutch that uses the SQLite3 prepare/bind/step APIs to provide a simplistic interface for use when it is adequate for the purpose.

It sounds like it is not adequate for your purpose.

Therefore, you should use the prepare/bind/step APIs directly.

And no, the callback function is used to handle the text results of executing the statement.