Name

sqlite3_get_autocommit() — Get the current transaction mode

Definition

int sqlite3_get_autocommit( sqlite3* db );
db

A database connection.

Returns

A nonzero value if the given database connection is in autocommit mode, a zero value if it is not.

Description

This function returns the current transaction mode. A nonzero return value indicates that the given database connection is in autocommit mode, meaning that no explicit transaction is open. A return value of zero means that an explicit transaction is in progress.

If an error is encountered while in an explicit transaction, there may be times when SQLite is forced to roll back the transaction. This function can be used to detect if the rollback happened or not.

See Also

BEGIN TRANSACTION [SQL Cmd, Ap C]

Get Using SQLite now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.