if (db_intransaction && !db_errcode) {
if (!db_committransaction()) {
handledatabaseerror(s);
- db_rollbacktransaction();
} else {
/* clear xferlog now that everything is in database */
iterator = s->dcache;
printf("db: commit transaction\n");
}
+ db_intransaction = 0;
+
rc = sqlite3_exec(db, "COMMIT", 0, 0, 0);
if (rc) {
snprintf(errorstring, 1024, "Commit transaction to database failed (%d): %s", rc, sqlite3_errmsg(db));
db_rollbacktransaction();
}
db_errcode = rc;
- db_intransaction = 0;
return 0;
}
- db_intransaction = 0;
return 1;
}
printf("db: rollback transaction\n");
}
+ db_intransaction = 0;
+
rc = sqlite3_exec(db, "ROLLBACK", 0, 0, 0);
if (rc) {
db_errcode = rc;
snprintf(errorstring, 1024, "Transaction rollback failed (%d): %s", rc, sqlite3_errmsg(db));
printe(PT_Error);
- db_intransaction = 0;
return 0;
}
- db_intransaction = 0;
return 1;
}