1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-12-10 22:22:40 +03:00

New experimental API for attaching client data to a database connection.

FossilOrigin-Name: d542837fdb42ebe810fc99225860d2cc7e6dd829a635bde820a09beff6bcb481
This commit is contained in:
drh
2023-08-30 15:20:15 +00:00
parent 8dd07389ac
commit 10deb35995
5 changed files with 148 additions and 25 deletions

View File

@@ -1256,6 +1256,7 @@ typedef struct Column Column;
typedef struct Cte Cte;
typedef struct CteUse CteUse;
typedef struct Db Db;
typedef struct DbClientData DbClientData;
typedef struct DbFixer DbFixer;
typedef struct Schema Schema;
typedef struct Expr Expr;
@@ -1734,6 +1735,7 @@ struct sqlite3 {
i64 nDeferredCons; /* Net deferred constraints this transaction. */
i64 nDeferredImmCons; /* Net deferred immediate constraints */
int *pnBytesFreed; /* If not NULL, increment this in DbFree() */
DbClientData *pDbData; /* sqlite3_set_clientdata() content */
#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY
/* The following variables are all protected by the STATIC_MAIN
** mutex, not by sqlite3.mutex. They are used by code in notify.c.
@@ -4341,6 +4343,16 @@ struct CteUse {
};
/* Client data associated with sqlite3_set_clientdata() and
** sqlite3_get_clientdata().
*/
struct DbClientData {
DbClientData *pNext; /* Next in a linked list */
void *pData; /* The data */
void (*xDestructor)(void*); /* Destructor. Might be NULL */
char zName[1]; /* Name of this client data. MUST BE LAST */
};
#ifdef SQLITE_DEBUG
/*
** An instance of the TreeView object is used for printing the content of