_sqlite3_bind_parameter_count
_sqlite3_bind_parameter_index
_sqlite3_bind_text
+_sqlite3_busy_handler
_sqlite3_busy_timeout
_sqlite3_changes
_sqlite3_changes64
_sqlite3_column_type
_sqlite3_compileoption_get
_sqlite3_compileoption_used
+_sqlite3_complete
_sqlite3_create_function
_sqlite3_create_function_v2
+_sqlite3_create_module
+_sqlite3_create_module_v2
_sqlite3_create_window_function
_sqlite3_data_count
_sqlite3_db_filename
_sqlite3_db_handle
_sqlite3_db_name
+_sqlite3_declare_vtab
_sqlite3_deserialize
+_sqlite3_drop_modules
_sqlite3_errmsg
_sqlite3_error_offset
_sqlite3_errstr
_sqlite3_msize
_sqlite3_open
_sqlite3_open_v2
+_sqlite3_overload_function
_sqlite3_prepare_v2
_sqlite3_prepare_v3
_sqlite3_randomness
_sqlite3_vfs_find
_sqlite3_vfs_register
_sqlite3_vfs_unregister
+_sqlite3_vtab_distinct
+_sqlite3_vtab_in
+_sqlite3_vtab_in_first
+_sqlite3_vtab_in_next
+_sqlite3_vtab_nochange
+_sqlite3_vtab_on_conflict
+_sqlite3_vtab_rhs_value
_malloc
_free
_realloc
});
delete self.Jaccwabyt;
- if(0){
- /* "The problem" is that the following isn't even remotely
- type-safe. OTOH, nothing about WASM pointers is. */
- const argPointer = wasm.xWrap.argAdapter('*');
- wasm.xWrap.argAdapter('StructType', (v)=>{
- if(v && v.constructor && v instanceof StructBinder.StructType){
- v = v.pointer;
- }
- return wasm.isPtr(v)
- ? argPointer(v)
- : toss("Invalid (object) type for StructType-type argument.");
- });
- }
-
{/* Convert Arrays and certain TypedArrays to strings for
'flexible-string'-type arguments */
const xString = wasm.xWrap.argAdapter('string');
`sqlite3_vfs*` via capi.sqlite3_vfs.pointer.
*/
const aPtr = wasm.xWrap.argAdapter('*');
+ const nilType = function(){};
wasm.xWrap.argAdapter('sqlite3_filename', aPtr)
('sqlite3_stmt*', aPtr)
('sqlite3_context*', aPtr)
('sqlite3_value*', aPtr)
('void*', aPtr)
- ('sqlite3*', (v)=>{
- if(sqlite3.oo1 && v instanceof sqlite3.oo1.DB) v = v.pointer;
- return aPtr(v);
- })
+ ('sqlite3*', (v)=>
+ aPtr((v instanceof (sqlite3?.oo1?.DB || nilType))
+ ? v.pointer : v))
+ ('sqlite3_index_info*', (v)=>
+ aPtr((v instanceof (capi.sqlite3_index_info || nilType))
+ ? v.pointer : v))
+ ('sqlite3_module*', (v)=>
+ aPtr((v instanceof (capi.sqlite3_module || nilType))
+ ? v.pointer : v))
/**
`sqlite3_vfs*`:
*/
('sqlite3_vfs*', (v)=>{
if('string'===typeof v){
- const x = capi.sqlite3_vfs_find(v);
/* A NULL sqlite3_vfs pointer will be treated as the default
VFS in many contexts. We specifically do not want that
behavior here. */
- if(!x) sqlite3.SQLite3Error.toss("Unknown sqlite3_vfs name:",v);
- return x;
- }else if(v instanceof sqlite3.capi.sqlite3_vfs) v = v.pointer;
- return aPtr(v);
+ return capi.sqlite3_vfs_find(v)
+ || sqlite3.SQLite3Error.toss("Unknown sqlite3_vfs name:",v);
+ }
+ return aPtr((v instanceof capi.sqlite3_vfs) ? v.pointer : v);
});
wasm.xWrap.resultAdapter('sqlite3*', aPtr)
: fI64Disabled(e[0]);
}
- /* There's no(?) need to expose bindingSignatures to clients,
+ /* There's no need to expose bindingSignatures to clients,
implicitly making it part of the public interface. */
delete wasm.bindingSignatures;
return errCode;
};
}
-
}/*xWrap() bindings*/;
- /**
- When registering a VFS and its related components it may be
- necessary to ensure that JS keeps a reference to them to keep
- them from getting garbage collected. Simply pass each such value
- to this function and a reference will be held to it for the life
- of the app.
- */
- capi.sqlite3_vfs_register.addReference = function f(...args){
- if(!f._) f._ = [];
- f._.push(...args);
- };
-
/**
Internal helper to assist in validating call argument counts in
the hand-written sqlite3_xyz() wrappers. We do this only for
}
wasm.ctype = JSON.parse(wasm.cstringToJs(cJson));
//console.debug('wasm.ctype length =',wasm.cstrlen(cJson));
- const defineGroups = ['access', 'blobFinalizers', 'dataTypes',
+ const defineGroups = ['access', 'authorizer',
+ 'blobFinalizers', 'dataTypes',
'encodings', 'fcntl', 'flock', 'ioCap',
- 'limits',
- 'openFlags', 'prepareFlags', 'resultCodes',
+ 'limits', 'openFlags',
+ 'prepareFlags', 'resultCodes',
'serialize', 'syncFlags', 'trace', 'udfFlags',
'version' ];
if(wasm.bigIntEnabled){
capi.sqlite3_index_info[k] = capi[k];
delete capi[k];
}
- }
+ capi.sqlite3_vtab_config =
+ (pDb, op, arg=0)=>wasm.exports.sqlite3_wasm_vtab_config(
+ wasm.xWrap.argAdapter('sqlite3*')(pDb), op, arg);
+ }/* end vtab-related setup */
}/*end C constant and struct imports*/
const pKvvfs = capi.sqlite3_vfs_find("kvvfs");
the lines of sqlite3_prepare_v3(). The slightly problematic
part is the final argument (text destructor). */
],
+ //["sqlite3_busy_handler","int", "sqlite3*", "*", "*"],
+ // ^^^^ TODO: custom binding which auto-converts JS function arg
+ // to a WASM function, noting that calling it multiple times
+ // would introduce a leak.
["sqlite3_busy_timeout","int", "sqlite3*", "int"],
["sqlite3_close_v2", "int", "sqlite3*"],
["sqlite3_changes", "int", "sqlite3*"],
["sqlite3_column_type","int", "sqlite3_stmt*", "int"],
["sqlite3_compileoption_get", "string", "int"],
["sqlite3_compileoption_used", "int", "string"],
+ ["sqlite3_complete", "int", "flexible-string"],
/* sqlite3_create_function(), sqlite3_create_function_v2(), and
sqlite3_create_window_function() use hand-written bindings to
simplify handling of their function-type arguments. */
["sqlite3_bind_int64","int", ["sqlite3_stmt*", "int", "i64"]],
["sqlite3_changes64","i64", ["sqlite3*"]],
["sqlite3_column_int64","i64", ["sqlite3_stmt*", "int"]],
+ ["sqlite3_create_module", "int",
+ ["sqlite3*","string","sqlite3_module*","*"]],
+ ["sqlite3_create_module_v2", "int",
+ ["sqlite3*","string","sqlite3_module*","*","*"]],
+ ["sqlite3_declare_vtab", "int", ["sqlite3*", "flexible-string"]],
+ ["sqlite3_drop_modules", "int", ["sqlite3*", "**"]],
["sqlite3_malloc64", "*","i64"],
["sqlite3_msize", "i64", "*"],
+ ["sqlite3_overload_function", "int", ["sqlite3*","string","int"]],
["sqlite3_realloc64", "*","*", "i64"],
["sqlite3_result_int64",undefined, "*", "i64"],
["sqlite3_result_zeroblob64", "int", "*", "i64"],
["sqlite3_total_changes64", "i64", ["sqlite3*"]],
["sqlite3_uri_int64", "i64", ["sqlite3_filename", "string", "i64"]],
["sqlite3_value_int64","i64", "sqlite3_value*"],
+ //EXPERIMENTAL const char *sqlite3_vtab_collation(sqlite3_index_info*,int)
+ ["sqlite3_vtab_distinct","int", "sqlite3_index_info*"],
+ ["sqlite3_vtab_in","int", "sqlite3_index_info*", "int", "int"],
+ ["sqlite3_vtab_in_first", "int", "sqlite3_value*", "**"],
+ ["sqlite3_vtab_in_next", "int", "sqlite3_value*", "**"],
+ /*["sqlite3_vtab_config" is variadic and requires a hand-written
+ proxy.] */
+ ["sqlite3_vtab_nochange","int", "sqlite3_context*"],
+ ["sqlite3_vtab_on_conflict","int", "sqlite3*"],
+ ["sqlite3_vtab_rhs_value","int", "sqlite3_index_info*", "int", "**"]
];
/**
DefInt(SQLITE_ACCESS_READ)/*docs say this is unused*/;
} _DefGroup;
-#if 0
/* TODO? Authorizer... */
DefGroup(authorizer){
DefInt(SQLITE_DENY);
DefInt(SQLITE_IGNORE);
} _DefGroup;
-#endif
DefGroup(blobFinalizers) {
/* SQLITE_STATIC/TRANSIENT need to be handled explicitly as
DefInt(SQLITE_INDEX_CONSTRAINT_LIMIT);
DefInt(SQLITE_INDEX_CONSTRAINT_OFFSET);
DefInt(SQLITE_INDEX_CONSTRAINT_FUNCTION);
+ DefInt(SQLITE_VTAB_CONSTRAINT_SUPPORT);
+ DefInt(SQLITE_VTAB_INNOCUOUS);
+ DefInt(SQLITE_VTAB_DIRECTONLY);
+ DefInt(SQLITE_ROLLBACK);
+ //DefInt(SQLITE_IGNORE); // Also used by sqlite3_authorizer() callback
+ DefInt(SQLITE_FAIL);
+ //DefInt(SQLITE_ABORT); // Also an error code
+ DefInt(SQLITE_REPLACE);
} _DefGroup;
#undef DefGroup
M(xShadowName, "i(s)");
} _StructBinder;
#undef CurrentStruct
- /*
- module/vtab todos:
-
- - sqlite3_create_module()
- - sqlite3_create_module_v2()
- - sqlite3_drop_modules()
- - sqlite3_declare_vtab()
- - sqlite3_overload_function()
- */
/**
** Workaround: in order to map the various inner structs from
return &sqlite3KvvfsMethods;
}
+/*
+** This function is NOT part of the sqlite3 public API. It is strictly
+** for use by the sqlite project's own JS/WASM bindings.
+**
+** This is a proxy for the variadic sqlite3_vtab_config() which passes
+** its argument on, or not, to sqlite3_vtab_config(), depending on the
+** value of its 2nd argument. Returns the result of
+** sqlite3_vtab_config(), or SQLITE_MISUSE if the 2nd arg is not a
+** valid value.
+*/
+SQLITE_WASM_KEEP
+int sqlite3_wasm_vtab_config(sqlite3 *pDb, int op, int arg){
+ switch(op){
+ case SQLITE_VTAB_DIRECTONLY:
+ case SQLITE_VTAB_INNOCUOUS:
+ return sqlite3_vtab_config(pDb, op);
+ case SQLITE_VTAB_CONSTRAINT_SUPPORT:
+ return sqlite3_vtab_config(pDb, op, arg);
+ default:
+ return SQLITE_MISUSE;
+ }
+
+}
+
+
#if defined(__EMSCRIPTEN__) && defined(SQLITE_ENABLE_WASMFS)
#include <emscripten/wasmfs.h>
-C Remove\ssome\sdead\scode.\sImprove\ssome\serror\schecks\sand\scomments.
-D 2022-12-05T05:45:00.486
+C More\swork\son\sthe\sJS\sside\sof\sthe\svirtual\stable\sAPIs.
+D 2022-12-05T07:51:25.186
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
F ext/wasm/GNUmakefile bfa47f169468ca9db031105b0e336db29a88e93c3abd217d0bbb2b8731fa5413
F ext/wasm/README-dist.txt 2d670b426fc7c613b90a7d2f2b05b433088fe65181abead970980f0a4a75ea20
F ext/wasm/README.md ef39861aa21632fdbca0bdd469f78f0096f6449a720f3f39642594af503030e9
-F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api 89af0612bad5c651f69e629c7e9689be6d3c8a92a9010da5dd90a87c1d86817a
+F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api 5b042c543c83134c20d222b7b8cd9e3401a5d552d709364d82461c064cd26089
F ext/wasm/api/EXPORTED_RUNTIME_METHODS.sqlite3-api 1ec3c73e7d66e95529c3c64ac3de2470b0e9e7fbf7a5b41261c367cf4f1b7287
F ext/wasm/api/README.md 20a256f4aaae80035d2bb1c9e3e0a125570313a8d137d427471d7be10edde87a
F ext/wasm/api/extern-post-js.c-pp.js 8923f76c3d2213159e12d641dc750523ead5c848185dc4996fae5cc12397f88d
F ext/wasm/api/post-js-header.js 47b6b281f39ad59fa6e8b658308cd98ea292c286a68407b35ff3ed9cfd281a62
F ext/wasm/api/pre-js.c-pp.js b88499dc303c21fc3f55f2c364a0f814f587b60a95784303881169f9e91c1d5f
F ext/wasm/api/sqlite3-api-cleanup.js 680d5ccfff54459db136a49b2199d9f879c8405d9c99af1dda0cc5e7c29056f4
-F ext/wasm/api/sqlite3-api-glue.js 40504fa3d382b9181e20e299ac5318ef55345090b8f5098601d7f759d57d6418
+F ext/wasm/api/sqlite3-api-glue.js dd7f3cc427154f280d9718dbc755ae4ed21c81d193f16b32184731c299c1d3be
F ext/wasm/api/sqlite3-api-oo1.js 91a7d7b9203fb0f031e6ba380a644a7f871e1798b388de399c01ed4087bac9e0
-F ext/wasm/api/sqlite3-api-prologue.js 697a5989ad52a9ba7bc60b5436589bd05885ee2201d84c38c5e9af3876af3ba4
+F ext/wasm/api/sqlite3-api-prologue.js d2cb6dd5ca109b36c5038301a6881f6ca137b946350e79e701114e461ab56298
F ext/wasm/api/sqlite3-api-worker1.js e94ba98e44afccfa482874cd9acb325883ade50ed1f9f9526beb9de1711f182f
F ext/wasm/api/sqlite3-license-version-header.js a661182fc93fc2cf212dfd0b987f8e138a3ac98f850b1112e29b5fbdaecc87c3
F ext/wasm/api/sqlite3-opfs-async-proxy.js f79dd8d98ef3e0b55c10bb2bee7a3840fa967318e1f577c156aafc34664271d1
F ext/wasm/api/sqlite3-vfs-helper.js 4ad4faf02e1524bf0296be8452c00b5708dce6faf649468d0377e26a0b299263
F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 29d6487a26b2fb6a471cde52c37ffee7c27ed6a91914b308c247e0706f454ffb
F ext/wasm/api/sqlite3-wasi.h 25356084cfe0d40458a902afb465df8c21fc4152c1d0a59b563a3fba59a068f9
-F ext/wasm/api/sqlite3-wasm.c 5120fb3419aba02d20cbe1e645b58dae5faeaaae8ccd46b8931ae04d311df9e5
+F ext/wasm/api/sqlite3-wasm.c 723522a6c2a2463884a83fa1cc7ae5770deaaf0856a1058cc1023b2bfa1c898b
F ext/wasm/api/sqlite3-worker1-promiser.js 0c7a9826dbf82a5ed4e4f7bf7816e825a52aff253afbf3350431f5773faf0e4b
F ext/wasm/api/sqlite3-worker1.js 1e54ea3d540161bcfb2100368a2fc0cad871a207b8336afee1c445715851ec54
F ext/wasm/batch-runner.html 4deeed44fe41496dc6898d9fb17938ea3291f40f4bfb977e29d0cef96fbbe4c8
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P c202d7a0398b9aabc2babba5c4c91a313f32bbf37549d419775642bb4aa3936a
-R acfab192817c95e0e585836998ec2507
+P 6712fbe46a97867cea309f78a274edbb6bd166a505b41e18a580306da0e063db
+R 556ab7e7db905d4fcefcfcbe9067fc69
U stephan
-Z 572c98dbcc011253d2f467baefba9d4d
+Z c9a0ef228c6ee4583769e98c5e79436a
# Remove this line to create a well-formed Fossil manifest.
-6712fbe46a97867cea309f78a274edbb6bd166a505b41e18a580306da0e063db
\ No newline at end of file
+cb9881ec001b0e2faf047e57acfd1722d2b546255a54e0f850f568edfe2df1cd
\ No newline at end of file