Enumerate last query result when I pass several to sqlite3_prepare_v2() in one string

20 hours ago 1
ARTICLE AD BOX

I prepare an SQLite query:

std::string sql = "CREATE TEMPORARY TABLE T1 AS SELECT * FROM TABLE1 ; SELECT * FROM T1";

TABLE1 isn't empty. I enumerate rows of the 2nd query (SELECT FROM T1) using:

int rc = sqlite3_prepare_v2(db, sql.c_str(), -1, &ppStmt, &pzTail); rc = sqlite3_step(ppStmt);

I get return code 101 from sqlite3_step as if the result is empty (SQLITE_DONE). At the same time pzTail points to string "SELECT * FROM T1", as if it didn't compile and therefore, didn't run.

How can I enumerate result rows of the 2nd part of my query?

Read Entire Article