Sq3LiteC - configure the class … More...
Macros | |
#define | Sq3Fupu_Sq3LiteBusyHandler_arg1_ret MK_I32 |
#define | Sq3Fupu_Sq3LiteBusyHandler_arg1_args MK_PTR arg0, MK_I32 arg1 |
#define | Sq3Fupu_Sq3LiteCommitHook_arg1_ret MK_I32 |
#define | Sq3Fupu_Sq3LiteCommitHook_arg1_args MK_PTR arg0 |
#define | Sq3Fupu_Sq3LiteRollbackHook_arg1_ret void |
#define | Sq3Fupu_Sq3LiteRollbackHook_arg1_args MK_PTR arg0 |
#define | Sq3Fupu_Sq3LiteUpdateHook_arg1_ret void |
#define | Sq3Fupu_Sq3LiteUpdateHook_arg1_args MK_PTR arg0, MK_I32 arg1, MK_STRN arg2, MK_STRN arg3, sqlite3_int64 arg4 |
Functions | |
static enum MkErrorE | Sq3LiteBusyHandler (SQ3_LITE sq3lite, Sq3Fupu_Sq3LiteBusyHandler_arg1 arg1, MK_PTR arg2) |
Register A Callback To Handle SQLITE_BUSY Errors … | |
static enum MkErrorE | Sq3LiteBusyTimeout (SQ3_LITE sq3lite, MK_I32 ms) |
Set A Busy Timeout … | |
static MK_PTR | Sq3LiteCommitHook (SQ3_LITE sq3lite, Sq3Fupu_Sq3LiteCommitHook_arg1 arg1, MK_PTR arg2) |
Commit And Rollback Notification Callbacks … | |
static enum MkErrorE | Sq3LiteDeclareVtab (SQ3_LITE sq3lite, MK_STRN zSQL) |
Declare The Schema Of A Virtual Table … | |
static enum MkErrorE | Sq3LiteExtendedResultCodes (SQ3_LITE sq3lite, MK_I32 onoff) |
Enable Or Disable Extended Result Codes … | |
static enum MkErrorE | Sq3LiteLimit (SQ3_LITE sq3lite, enum Sq3LimitE id, MK_I32 newVal) |
Run-time Limits … | |
static MK_PTR | Sq3LiteRollbackHook (SQ3_LITE sq3lite, Sq3Fupu_Sq3LiteRollbackHook_arg1 arg1, MK_PTR arg2) |
Commit And Rollback Notification Callbacks … | |
static MK_PTR | Sq3LiteUpdateHook (SQ3_LITE sq3lite, Sq3Fupu_Sq3LiteUpdateHook_arg1 arg1, MK_PTR arg2) |
Data Change Notification Callbacks … | |
Sq3LiteC - Sq3LiteC_Config_C_API - overload | |
#define | Sq3LiteBusyHandler_E(...) |
#define | Sq3LiteBusyHandler_C(...) |
#define | Sq3LiteBusyTimeout_E(...) |
#define | Sq3LiteBusyTimeout_C(...) |
#define | Sq3LiteDeclareVtab_E(...) |
#define | Sq3LiteDeclareVtab_C(...) |
#define | Sq3LiteExtendedResultCodes_E(...) |
#define | Sq3LiteExtendedResultCodes_C(...) |
#define | Sq3LiteLimit_E(...) |
#define | Sq3LiteLimit_C(...) |
Sq3LiteC - configure the class …
Definition at line 59 of file Sq3LiteC_sq3.h.
#define Sq3Fupu_Sq3LiteBusyHandler_arg1_ret MK_I32 |
Definition at line 58 of file Sq3LiteC_sq3.h.
#define Sq3Fupu_Sq3LiteCommitHook_arg1_args MK_PTR arg0 |
Definition at line 66 of file Sq3LiteC_sq3.h.
#define Sq3Fupu_Sq3LiteCommitHook_arg1_ret MK_I32 |
Definition at line 65 of file Sq3LiteC_sq3.h.
#define Sq3Fupu_Sq3LiteRollbackHook_arg1_args MK_PTR arg0 |
Definition at line 73 of file Sq3LiteC_sq3.h.
#define Sq3Fupu_Sq3LiteRollbackHook_arg1_ret void |
Definition at line 72 of file Sq3LiteC_sq3.h.
#define Sq3Fupu_Sq3LiteUpdateHook_arg1_args MK_PTR arg0, MK_I32 arg1, MK_STRN arg2, MK_STRN arg3, sqlite3_int64 arg4 |
Definition at line 80 of file Sq3LiteC_sq3.h.
#define Sq3Fupu_Sq3LiteUpdateHook_arg1_ret void |
Definition at line 79 of file Sq3LiteC_sq3.h.
#define Sq3LiteBusyHandler_C | ( | ... | ) |
Definition at line 362 of file sqlite3_overload_sq3.h.
#define Sq3LiteBusyHandler_E | ( | ... | ) |
Definition at line 361 of file sqlite3_overload_sq3.h.
#define Sq3LiteBusyTimeout_C | ( | ... | ) |
Definition at line 364 of file sqlite3_overload_sq3.h.
#define Sq3LiteBusyTimeout_E | ( | ... | ) |
Definition at line 363 of file sqlite3_overload_sq3.h.
#define Sq3LiteDeclareVtab_C | ( | ... | ) |
Definition at line 366 of file sqlite3_overload_sq3.h.
#define Sq3LiteDeclareVtab_E | ( | ... | ) |
Definition at line 365 of file sqlite3_overload_sq3.h.
#define Sq3LiteExtendedResultCodes_C | ( | ... | ) |
Definition at line 368 of file sqlite3_overload_sq3.h.
#define Sq3LiteExtendedResultCodes_E | ( | ... | ) |
Definition at line 367 of file sqlite3_overload_sq3.h.
#define Sq3LiteLimit_C | ( | ... | ) |
Definition at line 370 of file sqlite3_overload_sq3.h.
#define Sq3LiteLimit_E | ( | ... | ) |
Definition at line 369 of file sqlite3_overload_sq3.h.
typedef Sq3Fupu_Sq3LiteBusyHandler_arg1_ret(* Sq3Fupu_Sq3LiteBusyHandler_arg1) (Sq3Fupu_Sq3LiteBusyHandler_arg1_args) |
Definition at line 60 of file Sq3LiteC_sq3.h.
typedef Sq3Fupu_Sq3LiteCommitHook_arg1_ret(* Sq3Fupu_Sq3LiteCommitHook_arg1) (Sq3Fupu_Sq3LiteCommitHook_arg1_args) |
Definition at line 67 of file Sq3LiteC_sq3.h.
typedef Sq3Fupu_Sq3LiteRollbackHook_arg1_ret(* Sq3Fupu_Sq3LiteRollbackHook_arg1) (Sq3Fupu_Sq3LiteRollbackHook_arg1_args) |
Definition at line 74 of file Sq3LiteC_sq3.h.
typedef Sq3Fupu_Sq3LiteUpdateHook_arg1_ret(* Sq3Fupu_Sq3LiteUpdateHook_arg1) (Sq3Fupu_Sq3LiteUpdateHook_arg1_args) |
Definition at line 81 of file Sq3LiteC_sq3.h.
|
inlinestatic |
Register A Callback To Handle SQLITE_BUSY Errors …
The Sq3LiteBusyHandler(D,X,P) routine sets a callback function X that might be invoked with argument P whenever an attempt is made to access a database table associated with database connection D when another thread or process has the table locked. The Sq3LiteBusyHandler() interface is used to implement Sq3LiteBusyTimeout () and PRAGMA busy_timeout.
If the busy callback is NULL, then SQ3_RESULT_BUSY is returned immediately upon encountering the lock. If the busy callback is not NULL, then the callback might be invoked with two arguments.
The first argument to the busy handler is a copy of the void* pointer which is the third argument to Sq3LiteBusyHandler(). The second argument to the busy handler callback is the number of times that the busy handler has been invoked previously for the same locking event. If the busy callback returns 0, then no additional attempts are made to access the database and SQ3_RESULT_BUSY is returned to the application. If the callback returns non-zero, then another attempt is made to access the database and the cycle repeats.
The presence of a busy handler does not guarantee that it will be invoked when there is lock contention. If SQLite determines that invoking the busy handler could result in a deadlock, it will go ahead and return SQ3_RESULT_BUSY to the application instead of invoking the busy handler. Consider a scenario where one process is holding a read lock that it is trying to promote to a reserved lock and a second process is holding a reserved lock that it is trying to promote to an exclusive lock. The first process cannot proceed because it is blocked by the second and the second process cannot proceed because it is blocked by the first. If both processes invoke the busy handlers, neither will make any progress. Therefore, SQLite returns SQ3_RESULT_BUSY for the first process, hoping that this will induce the first process to release its read lock and allow the second process to proceed.
The default busy callback is NULL.
There can only be a single busy handler defined for each database connection. Setting a new busy handler clears any previously set handler. Note that calling Sq3LiteBusyTimeout () or evaluating PRAGMA busy_timeout=N will change the busy handler and thus clear any previously set busy handler.
The busy callback should not take any actions which modify the database connection that invoked the busy handler. In other words, the busy handler is not reentrant. Any such actions result in undefined behavior.
A busy handler must not close the database connection or prepared statement that invoked the busy handler.
Reference code from sqlite3:
Definition at line 133 of file Sq3LiteC_sq3.h.
enum MkErrorE Sq3LiteBusyHandlerP | ( | SQ3_LITE | sq3lite, |
Sq3Fupu_Sq3LiteBusyHandler_arg1 | arg1, | ||
MK_PTR | arg2 ) |
Non-inline replacement for Sq3LiteBusyHandler …
Set A Busy Timeout …
This routine sets a busy handler that sleeps for a specified amount of time when a table is locked. The handler will sleep multiple times until at least "ms" milliseconds of sleeping have accumulated. After at least "ms" milliseconds of sleeping, the handler returns 0 which causes Sq3StmtStep () to return SQ3_RESULT_BUSY.
Calling this routine with an argument less than or equal to zero turns off all busy handlers.
There can only be a single busy handler for a particular database connection at any given moment. If another busy handler was defined (using Sq3LiteBusyHandler ()) prior to calling this routine, that other busy handler is cleared.
See also: PRAGMA busy_timeout
Reference code from sqlite3:
Definition at line 143 of file Sq3LiteC_sq3.h.
Non-inline replacement for Sq3LiteBusyTimeout …
|
inlinestatic |
Commit And Rollback Notification Callbacks …
The Sq3LiteCommitHook() interface registers a callback function to be invoked whenever a transaction is committed. Any callback set by a previous call to Sq3LiteCommitHook() for the same database connection is overridden. The Sq3LiteRollbackHook() interface registers a callback function to be invoked whenever a transaction is rolled back. Any callback set by a previous call to Sq3LiteRollbackHook() for the same database connection is overridden. The pArg argument is passed through to the callback. If the callback on a commit hook function returns non-zero, then the commit is converted into a rollback.
The Sq3LiteCommitHook(D,C,P) and Sq3LiteRollbackHook(D,C,P) functions return the P argument from the previous call of the same function on the same database connection D, or NULL for the first call for each function on D.
The commit and rollback hook callbacks are not reentrant. The callback implementation must not do anything that will modify the database connection that invoked the callback. Any actions to modify the database connection must be deferred until after the completion of the Sq3StmtStep () call that triggered the commit or rollback hook in the first place. Note that running any other SQL statements, including SELECT statements, or merely calling Sq3StmtPrepareV2 () and Sq3StmtStep () will modify the database connections for the meaning of "modify" in this paragraph.
Registering a NULL function disables the callback.
When the commit hook callback routine returns zero, the COMMIT operation is allowed to continue normally. If the commit hook returns non-zero, then the COMMIT is converted into a ROLLBACK. The rollback hook is invoked on a rollback that results from a commit hook returning non-zero, just as it would be with any other rollback.
For the purposes of this API, a transaction is said to have been rolled back if an explicit "ROLLBACK" statement is executed, or an error or constraint causes an implicit rollback to occur. The rollback callback is not invoked if a transaction is automatically rolled back because the database connection is closed.
See also the Sq3LiteUpdateHook () interface.
Reference code from sqlite3:
Definition at line 153 of file Sq3LiteC_sq3.h.
MK_PTR Sq3LiteCommitHookP | ( | SQ3_LITE | sq3lite, |
Sq3Fupu_Sq3LiteCommitHook_arg1 | arg1, | ||
MK_PTR | arg2 ) |
Non-inline replacement for Sq3LiteCommitHook …
Declare The Schema Of A Virtual Table …
The xCreate and xConnect methods of a virtual table module call this interface to declare the format (the names and datatypes of the columns) of the virtual tables they implement.
Reference code from sqlite3:
Definition at line 159 of file Sq3LiteC_sq3.h.
Non-inline replacement for Sq3LiteDeclareVtab …
Enable Or Disable Extended Result Codes …
The Sq3LiteExtendedResultCodes() routine enables or disables the extended result codes feature of SQLite. The extended result codes are disabled by default for historical compatibility.
Reference code from sqlite3:
Definition at line 169 of file Sq3LiteC_sq3.h.
Non-inline replacement for Sq3LiteExtendedResultCodes …
|
inlinestatic |
Run-time Limits …
This interface allows the size of various constructs to be limited on a connection by connection basis. The first parameter is the database connection whose limit is to be set or queried. The second parameter is one of the limit categories that define a class of constructs to be size limited. The third parameter is the new limit for that construct.
If the new limit is a negative number, the limit is unchanged. For each limit category SQ3_LIMIT_NAME there is a hard upper bound set at compile-time by a C preprocessor macro called SQLITE_MAX_NAME. (The "_LIMIT_" in the name is changed to "_MAX_".) Attempts to increase a limit above its hard upper bound are silently truncated to the hard upper bound.
Regardless of whether or not the limit was changed, the Sq3LiteLimit () interface returns the prior value of the limit. Hence, to find the current value of a limit without changing it, simply invoke this interface with the third parameter set to -1.
Run-time limits are intended for use in applications that manage both their own internal database and also databases that are controlled by untrusted external sources. An example application might be a web browser that has its own databases for storing history and separate databases controlled by JavaScript applications downloaded off the Internet. The internal databases can be given the large, default limits. Databases managed by external sources can be given much smaller limits designed to prevent a denial of service attack. Developers might also want to use the Sq3LiteSetAuthorizer () interface to further control untrusted SQL. The size of the database created by an untrusted script can be contained using the max_page_count PRAGMA.
New run-time limit categories may be added in future releases.
Reference code from sqlite3:
Definition at line 179 of file Sq3LiteC_sq3.h.
Non-inline replacement for Sq3LiteLimit …
|
inlinestatic |
Commit And Rollback Notification Callbacks …
read more at 'Sq3LiteCommitHook'
Definition at line 189 of file Sq3LiteC_sq3.h.
MK_PTR Sq3LiteRollbackHookP | ( | SQ3_LITE | sq3lite, |
Sq3Fupu_Sq3LiteRollbackHook_arg1 | arg1, | ||
MK_PTR | arg2 ) |
Non-inline replacement for Sq3LiteRollbackHook …
|
inlinestatic |
Data Change Notification Callbacks …
The Sq3LiteUpdateHook() interface registers a callback function with the database connection identified by the first argument to be invoked whenever a row is updated, inserted or deleted in a rowid table. Any callback set by a previous call to this function for the same database connection is overridden.
The second argument is a pointer to the function to invoke when a row is updated, inserted or deleted in a rowid table. The first argument to the callback is a copy of the third argument to Sq3LiteUpdateHook(). The second callback argument is one of SQ3_AUTHACTION_INSERT, SQ3_AUTHACTION_DELETE, or SQ3_AUTHACTION_UPDATE, depending on the operation that caused the callback to be invoked. The third and fourth arguments to the callback contain pointers to the database and table name containing the affected row. The final callback parameter is the rowid of the row. In the case of an update, this is the rowid after the update takes place.
The update hook is not invoked when internal system tables are modified (i.e. sqlite_sequence). The update hook is not invoked when WITHOUT ROWID tables are modified.
In the current implementation, the update hook is not invoked when conflicting rows are deleted because of an ON CONFLICT REPLACE clause. Nor is the update hook invoked when rows are deleted using the truncate optimization. The exceptions defined in this paragraph might change in a future release of SQLite.
The update hook implementation must not do anything that will modify the database connection that invoked the update hook. Any actions to modify the database connection must be deferred until after the completion of the Sq3StmtStep () call that triggered the update hook. Note that Sq3StmtPrepareV2 () and Sq3StmtStep () both modify their database connections for the meaning of "modify" in this paragraph.
The Sq3LiteUpdateHook(D,C,P) function returns the P argument from the previous call on the same database connection D, or NULL for the first call on D.
See also the Sq3LiteCommitHook (), Sq3LiteRollbackHook (), and sqlite3_preupdate_hook () interfaces.
Reference code from sqlite3:
Definition at line 195 of file Sq3LiteC_sq3.h.
MK_PTR Sq3LiteUpdateHookP | ( | SQ3_LITE | sq3lite, |
Sq3Fupu_Sq3LiteUpdateHook_arg1 | arg1, | ||
MK_PTR | arg2 ) |
Non-inline replacement for Sq3LiteUpdateHook …