Skip to content

Commit 2adc35d

Browse files
authored
feat: added missing C API declarations (#151)
1 parent 9605fca commit 2adc35d

1 file changed

Lines changed: 186 additions & 1 deletion

File tree

src/index.d.ts

Lines changed: 186 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4462,6 +4462,31 @@ export type CAPI = {
44624462
*/
44634463
sqlite3_stmt_isexplain: (stmt: StmtPtr) => 0 | 1 | 2;
44644464

4465+
/**
4466+
* Set the explain mode for a statement.
4467+
*
4468+
* C Signature:
4469+
*
4470+
* int sqlite3_stmt_explain(sqlite3_stmt *pStmt, int eMode);
4471+
*
4472+
* See https://sqlite.org/c3ref/stmt_explain.html
4473+
*/
4474+
sqlite3_stmt_explain: (stmt: StmtPtr, eMode: number) => Sqlite3Result;
4475+
4476+
/**
4477+
* Return a pointer to the next prepared statement after `pStmt` associated
4478+
* with database connection `db`. If `pStmt` is null, return the first
4479+
* prepared statement for the database connection. Return 0 if there are no
4480+
* more.
4481+
*
4482+
* C Signature:
4483+
*
4484+
* sqlite3_stmt * sqlite3_next_stmt(sqlite3 * pDb, sqlite3_stmt * pStmt);
4485+
*
4486+
* See https://sqlite.org/c3ref/next_stmt.html
4487+
*/
4488+
sqlite3_next_stmt: (db: DbPtr, pStmt: StmtPtr | 0) => StmtPtr | 0;
4489+
44654490
/**
44664491
* Bind a `BLOB` value to a parameter in a prepared statement.
44674492
*
@@ -4701,6 +4726,39 @@ export type CAPI = {
47014726
*/
47024727
sqlite3_column_decltype: (stmt: StmtPtr, N: number) => string | null;
47034728

4729+
/**
4730+
* Return the name of the database from which a result column derives. Returns
4731+
* null if the column is not an unambiguous reference to a database column.
4732+
*
4733+
* C Signature:
4734+
*
4735+
* const char *sqlite3_column_database_name(sqlite3_stmt *pStmt, int N);
4736+
*/
4737+
sqlite3_column_database_name: (stmt: StmtPtr, N: number) => string | null;
4738+
4739+
/**
4740+
* Return the name of the table from which a result column derives. Returns
4741+
* null if the column is not an unambiguous reference to a database column.
4742+
*
4743+
* C Signature:
4744+
*
4745+
* const char *sqlite3_column_table_name(sqlite3_stmt *pStmt, int N);
4746+
*
4747+
* See https://sqlite.org/c3ref/column_database_name.html
4748+
*/
4749+
sqlite3_column_table_name: (stmt: StmtPtr, N: number) => string | null;
4750+
4751+
/**
4752+
* Return the name of the table column from which a result column derives.
4753+
* Returns null if the column is not an unambiguous reference to a database
4754+
* column.
4755+
*
4756+
* C Signature:
4757+
*
4758+
* const char *sqlite3_column_origin_name(sqlite3_stmt *pStmt, int N);
4759+
*/
4760+
sqlite3_column_origin_name: (stmt: StmtPtr, N: number) => string | null;
4761+
47044762
/**
47054763
* Returns the result of passing the result of
47064764
* `sqlite3_column_value(pStmt,iCol)` to `sqlite3_value_to_js()`. The 3rd
@@ -6213,6 +6271,44 @@ export type CAPI = {
62136271
resetFlag: number,
62146272
) => Sqlite3Result;
62156273

6274+
/**
6275+
* Used to retrieve runtime status information about a single database
6276+
* connection with 64-bit counters.
6277+
*
6278+
* C Signature:
6279+
*
6280+
* int sqlite3_db_status64(
6281+
* sqlite3 *db,
6282+
* int op,
6283+
* sqlite3_int64 *pCurrent,
6284+
* sqlite3_int64 *pHighwtr,
6285+
* int resetFlag
6286+
* );
6287+
*
6288+
* See https://www.sqlite.org/c3ref/db_status.html
6289+
*/
6290+
sqlite3_db_status64: (
6291+
db: DbPtr,
6292+
op:
6293+
| CAPI['SQLITE_DBSTATUS_LOOKASIDE_USED']
6294+
| CAPI['SQLITE_DBSTATUS_CACHE_USED']
6295+
| CAPI['SQLITE_DBSTATUS_SCHEMA_USED']
6296+
| CAPI['SQLITE_DBSTATUS_STMT_USED']
6297+
| CAPI['SQLITE_DBSTATUS_LOOKASIDE_HIT']
6298+
| CAPI['SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE']
6299+
| CAPI['SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL']
6300+
| CAPI['SQLITE_DBSTATUS_CACHE_HIT']
6301+
| CAPI['SQLITE_DBSTATUS_CACHE_MISS']
6302+
| CAPI['SQLITE_DBSTATUS_CACHE_WRITE']
6303+
| CAPI['SQLITE_DBSTATUS_DEFERRED_FKS']
6304+
| CAPI['SQLITE_DBSTATUS_CACHE_USED_SHARED']
6305+
| CAPI['SQLITE_DBSTATUS_CACHE_SPILL']
6306+
| CAPI['SQLITE_DBSTATUS_MAX'],
6307+
pCurrent: WasmPointer,
6308+
pHighwtr: WasmPointer,
6309+
resetFlag: number,
6310+
) => Sqlite3Result;
6311+
62166312
/**
62176313
* Retrieve and reset counter values from a prepared statement.
62186314
*
@@ -7446,7 +7542,7 @@ export type CAPI = {
74467542
* int flags
74477543
* );
74487544
*
7449-
* See https://www.sqlite.org/c3ref/changeset_apply.html
7545+
* See https://sqlite.org/session/sqlite3changeset_apply.html
74507546
*
74517547
* @param db Apply change to `"main"` db of this handle
74527548
* @param nChangeset Size of changeset blob in bytes
@@ -7484,6 +7580,53 @@ export type CAPI = {
74847580
flags: number,
74857581
) => Sqlite3Result;
74867582

7583+
/**
7584+
* Apply a changeset or patchset to a database (V3 variant). This is like
7585+
* `sqlite3changeset_apply_v2()` but the filter callback is invoked once per
7586+
* change and receives an iterator handle for the current change.
7587+
*
7588+
* C Signature:
7589+
*
7590+
* int sqlite3changeset_apply_v3(
7591+
* sqlite3 *db,
7592+
* int nChangeset,
7593+
* void *pChangeset,
7594+
* int(*xFilter)(void *pCtx, sqlite3_changeset_iter *p),
7595+
* int (*xConflict)(void *pCtx, int eConflict, sqlite3_changeset_iter *p),
7596+
* void *pCtx,
7597+
* void **ppRebase,
7598+
* int *pnRebase,
7599+
* int flags
7600+
* );
7601+
*
7602+
* See https://sqlite.org/session/sqlite3changeset_apply.html
7603+
*/
7604+
sqlite3changeset_apply_v3: (
7605+
db: DbPtr,
7606+
nChangeset: number,
7607+
pChangeset: WasmPointer,
7608+
xFilter: ((pCtx: WasmPointer, pIter: WasmPointer) => number) | WasmPointer,
7609+
xConflict:
7610+
| ((
7611+
pCtx: WasmPointer,
7612+
eConflict:
7613+
| CAPI['SQLITE_CHANGESET_DATA']
7614+
| CAPI['SQLITE_CHANGESET_NOTFOUND']
7615+
| CAPI['SQLITE_CHANGESET_CONFLICT']
7616+
| CAPI['SQLITE_CHANGESET_FOREIGN_KEY']
7617+
| CAPI['SQLITE_CHANGESET_CONSTRAINT'],
7618+
pIter: WasmPointer,
7619+
) =>
7620+
| CAPI['SQLITE_CHANGESET_OMIT']
7621+
| CAPI['SQLITE_CHANGESET_ABORT']
7622+
| CAPI['SQLITE_CHANGESET_REPLACE'])
7623+
| WasmPointer,
7624+
pCtx: WasmPointer,
7625+
ppRebase: WasmPointer,
7626+
pnRebase: WasmPointer,
7627+
flags: number,
7628+
) => Sqlite3Result;
7629+
74877630
/**
74887631
* Streaming version of `sqlite3changeset_apply()`.
74897632
*
@@ -7581,6 +7724,48 @@ export type CAPI = {
75817724
flags: number,
75827725
) => Sqlite3Result;
75837726

7727+
/**
7728+
* Streaming version of `sqlite3changeset_apply_v3()`.
7729+
*
7730+
* C Signature:
7731+
*
7732+
* int sqlite3changeset_apply_v3_strm(
7733+
* sqlite3 *db,
7734+
* int (*xInput)(void *pIn, void *pData, int *pnData),
7735+
* void *pIn,
7736+
* int(*xFilter)(void *pCtx, sqlite3_changeset_iter *p),
7737+
* int (*xConflict)(void *pCtx, int eConflict, sqlite3_changeset_iter *p),
7738+
* void *pCtx,
7739+
* void **ppRebase, int *pnRebase,
7740+
* int flags
7741+
* );
7742+
*
7743+
* See https://sqlite.org/session/sqlite3changeset_apply.html
7744+
*/
7745+
sqlite3changeset_apply_v3_strm: (
7746+
db: DbPtr,
7747+
xInput:
7748+
| ((pIn: WasmPointer, pData: WasmPointer, pnData: WasmPointer) => number)
7749+
| WasmPointer,
7750+
pIn: WasmPointer,
7751+
xFilter: ((pCtx: WasmPointer, pIter: WasmPointer) => number) | WasmPointer,
7752+
xConflict:
7753+
| ((
7754+
pCtx: WasmPointer,
7755+
eConflict:
7756+
| CAPI['SQLITE_CHANGESET_DATA']
7757+
| CAPI['SQLITE_CHANGESET_NOTFOUND']
7758+
| CAPI['SQLITE_CHANGESET_CONFLICT']
7759+
| CAPI['SQLITE_CHANGESET_FOREIGN_KEY']
7760+
| CAPI['SQLITE_CHANGESET_CONSTRAINT'],
7761+
) => number)
7762+
| WasmPointer,
7763+
pCtx: WasmPointer,
7764+
ppRebase: WasmPointer,
7765+
pnRebase: WasmPointer,
7766+
flags: number,
7767+
) => Sqlite3Result;
7768+
75847769
/**
75857770
* Streaming version of `sqlite3changeset_concat()`.
75867771
*

0 commit comments

Comments
 (0)