Question for the paragraph in

"An implicit transaction (a transaction that is started automatically, not a 
transaction started by BEGIN) is committed automatically when the last active 
statement finishes. A statement finishes when its prepared statement is reset 
or finalized. An open sqlite3_blob used for incremental BLOB I/O counts as an 
unfinished statement. The sqlite3_blob finishes when it is closed."

This means without sqlite3_reset or sqlite3_finalize, the transaction is not 
commited. But my code shows it does commit immediately after sqlite3_step():

        int ite = 0;
        int rc = 0;
        sqlite3_stmt *stmt = NULL;
        char sql[] = "insert into test values (?1, ?2);";

        rc = sqlite3_prepare_v2(db, sql, strlen(sql) + 1, &stmt, NULL);
        if (rc) {

        for (ite = 0; ite < 1; ite++) {
                rc = sqlite3_reset(stmt);
                assert(rc == SQLITE_OK);

                sqlite3_bind_int(stmt, 1, ite);
                sqlite3_bind_int(stmt, 2, ite + 100);

                rc = sqlite3_step(stmt);
                if (rc != SQLITE_DONE) {
                        printf("sqlite3_step ite:%d %s", ite, 

I verified this through Linux Perf tools.

So, the result of the code is different with the Documentation, which one is 
correct ??

sqlite-users mailing list

Reply via email to