Hello, I open one connection to a sqlitedb and do a few successful autocommited sqlite3_exec() calls. Then I want to use the db handle to call another sqlite3_exec() with SQL code for a transaction. Before I close the connection I call again sqlite3_exec() with SQL COMMIT to end the transaction. This produces the sqlite error: cannot commit transaction - SQL statements in progress
I don't use statements and/or threading in my code but sqlite is compiled with threading enabled. I don't understand why there are statements in progress? In my code below I've used a while loop for the commit and this loops endless, always reporting the SQL statements in progress error. So what is going on there? What should I know? Bye Markus Part my code with transaction: strcpy(sql, "BEGIN EXCLUSIVE; INSERT INTO tbl_d (id) SELECT id FROM tbl_o WHERE bs LIKE '32' AND bd < '1141078718' AND id NOT IN ( SELECT id FROM tbl_d ); UPDATE tbl_o SET bs='64' WHERE bs LIKE '32' AND bd < '1141078718'"); if ((dberr = sqlite3_exec(gdbh, sql, NULL, NULL, &errmsg)) != SQLITE_OK) { msg(MSG_ERROR, "(%d) %s", dberr, errmsg); if (errmsg != NULL) sqlite3_free(errmsg); strcpy(sql, "ROLLBACK"); if ((dberr = sqlite3_exec(gdbh, sql, NULL, NULL, &errmsg)) != SQLITE_OK) { msg(MSG_ERROR, "(%d) %s", dberr, errmsg); if (errmsg != NULL) sqlite3_free(errmsg); } if (errmsg != NULL) sqlite3_free(errmsg); return; } if (errmsg != NULL) sqlite3_free(errmsg); strcpy(sql, "COMMIT"); while ((dberr = sqlite3_exec(gdbh, sql, NULL, NULL, &errmsg)) != SQLITE_OK) { if (errmsg != NULL) sqlite3_free(errmsg); } if (errmsg != NULL) sqlite3_free(errmsg);