Sq3LiteC - get information … More...
Functions | |
static MK_I32 | Sq3LiteGetAutocommit (SQ3_LITE sq3lite) |
Test For Auto-Commit Mode … | |
static MK_I64 | Sq3LiteLastInsertRowid (SQ3_LITE sq3lite) |
Last Insert Rowid … | |
static enum MkErrorE | Sq3LiteTxnState (SQ3_LITE sq3lite, MK_STRN zSchema) |
Determine the transaction state of a database … | |
static enum MkErrorE | Sq3LiteVtabOnConflict (SQ3_LITE sq3lite) |
Determine The Virtual Table Conflict Policy … | |
Sq3LiteC - Sq3LiteC_Info_C_API - function | |
MK_I32 | Sq3LiteGetAutocommitP (SQ3_LITE sq3lite) |
Non-inline replacement for Sq3LiteGetAutocommit … | |
MK_I64 | Sq3LiteLastInsertRowidP (SQ3_LITE sq3lite) |
Non-inline replacement for Sq3LiteLastInsertRowid … | |
enum MkErrorE | Sq3LiteTxnStateP (SQ3_LITE sq3lite, MK_STRN zSchema) |
Non-inline replacement for Sq3LiteTxnState … | |
enum MkErrorE | Sq3LiteVtabOnConflictP (SQ3_LITE sq3lite) |
Non-inline replacement for Sq3LiteVtabOnConflict … | |
Sq3LiteC - Sq3LiteC_Info_C_API - overload | |
#define | Sq3LiteTxnState_E(...) |
#define | Sq3LiteTxnState_C(...) |
#define | Sq3LiteVtabOnConflict_E(...) |
#define | Sq3LiteVtabOnConflict_C(...) |
Sq3LiteC - get information …
#define Sq3LiteTxnState_C | ( | ... | ) |
Definition at line 413 of file sqlite3_overload_sq3.h.
#define Sq3LiteTxnState_E | ( | ... | ) |
Definition at line 412 of file sqlite3_overload_sq3.h.
#define Sq3LiteVtabOnConflict_C | ( | ... | ) |
Definition at line 415 of file sqlite3_overload_sq3.h.
#define Sq3LiteVtabOnConflict_E | ( | ... | ) |
Definition at line 414 of file sqlite3_overload_sq3.h.
Test For Auto-Commit Mode …
The Sq3LiteGetAutocommit() interface returns non-zero or zero if the given database connection is or is not in autocommit mode, respectively. Autocommit mode is on by default. Autocommit mode is disabled by a BEGIN statement. Autocommit mode is re-enabled by a COMMIT or ROLLBACK.
If certain kinds of errors occur on a statement within a multi-statement transaction (errors including SQ3_RESULT_FULL, SQ3_RESULT_IOERR, SQ3_RESULT_NOMEM, SQ3_RESULT_BUSY, and SQ3_RESULT_INTERRUPT) then the transaction might be rolled back automatically. The only way to find out whether SQLite automatically rolled back the transaction after an error is to use this function.
If another thread changes the autocommit status of the database connection while this routine is running, then the return value is undefined.
Reference code from sqlite3:
Definition at line 284 of file Sq3LiteC_sq3.h.
Non-inline replacement for Sq3LiteGetAutocommit …
Last Insert Rowid …
Each entry in most SQLite tables (except for WITHOUT ROWID tables) has a unique 64-bit signed integer key called the "rowid". The rowid is always available as an undeclared column named ROWID, OID, or ROWID as long as those names are not also used by explicitly declared columns. If the table has a column of type INTEGER PRIMARY KEY then that column is another alias for the rowid.
The Sq3LiteLastInsertRowid(D) interface usually returns the rowid of the most recent successful INSERT into a rowid table or virtual table on database connection D. Inserts into WITHOUT ROWID tables are not recorded. If no successful INSERTs into rowid tables have ever occurred on the database connection D, then Sq3LiteLastInsertRowid(D) returns zero.
As well as being set automatically as rows are inserted into database tables, the value returned by this function may be set explicitly by Sq3LiteSetLastInsertRowid ()
Some virtual table implementations may INSERT rows into rowid tables as part of committing a transaction (e.g. to flush data accumulated in memory to disk). In this case subsequent calls to this function return the rowid associated with these internal INSERT operations, which leads to unintuitive results. Virtual table implementations that do write to rowid tables in this way can avoid this problem by restoring the original rowid value using Sq3LiteSetLastInsertRowid () before returning control to the user.
If an INSERT occurs within a trigger then this routine will return the rowid of the inserted row as long as the trigger is running. Once the trigger program ends, the value returned by this routine reverts to what it was before the trigger was fired.
An INSERT that fails due to a constraint violation is not a successful INSERT and does not change the value returned by this routine. Thus INSERT OR FAIL, INSERT OR IGNORE, INSERT OR ROLLBACK, and INSERT OR ABORT make no changes to the return value of this routine when their insertion fails. When INSERT OR REPLACE encounters a constraint violation, it does not fail. The INSERT continues to completion after deleting rows that caused the constraint problem so INSERT OR REPLACE will always change the return value of this interface.
For the purposes of this routine, an INSERT is considered to be successful even if it is subsequently rolled back.
This function is accessible to SQL statements via the last_insert_rowid() SQL function.
If a separate thread performs a new INSERT on the same database connection while the Sq3LiteLastInsertRowid () function is running and thus changes the last insert rowid, then the value returned by Sq3LiteLastInsertRowid () is unpredictable and might not equal either the old or the new last insert rowid.
Reference code from sqlite3:
Definition at line 290 of file Sq3LiteC_sq3.h.
Non-inline replacement for Sq3LiteLastInsertRowid …
Determine the transaction state of a database …
The Sq3LiteTxnState(D,S) interface returns the current transaction state of schema S in database connection D. If S is NULL, then the highest transaction state of any schema on database connection D is returned. Transaction states are (in order of lowest to highest):
If the S argument to Sq3LiteTxnState(D,S) is not the name of a valid schema, then -1 is returned.
Reference code from sqlite3:
Definition at line 296 of file Sq3LiteC_sq3.h.
Non-inline replacement for Sq3LiteTxnState …
Determine The Virtual Table Conflict Policy …
This function may only be called from within a call to the xUpdate method of a virtual table implementation for an INSERT or UPDATE operation. The value returned is one of SQ3_CONFLICT_ROLLBACK, SQ3_AUTHRETURN_IGNORE, SQ3_CONFLICT_FAIL, SQ3_RESULT_ABORT, or SQ3_CONFLICT_REPLACE, according to the ON CONFLICT mode of the SQL statement that triggered the call to the xUpdate method of the virtual table.
Reference code from sqlite3:
Definition at line 306 of file Sq3LiteC_sq3.h.
Non-inline replacement for Sq3LiteVtabOnConflict …