1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-01 06:27:03 +03:00

Add sqlite3.capi JS bindings for the sqlite3session_...(), sqlite3changeset_...() and sqlite3changegroup_...() APIs, noting that they are completely untested. Aside from missing tests, these bindings reveal a slight string-argument-type shortcoming in the callback function pointer "reverse binding" which should ideally be resolved before publishing them.

FossilOrigin-Name: 0a39172ee134816f5ce17a403b960e9c22bb56efd5bcf77ecde465efe0d88b1d
This commit is contained in:
stephan
2022-12-23 14:11:54 +00:00
parent cc1cc9d7b7
commit 0f29f17bf6
6 changed files with 249 additions and 29 deletions

View File

@ -446,7 +446,7 @@ self.WhWasmUtilInstaller = function(target){
type(s) of the given function signature, or throws if the
signature is invalid. */
/******** // only valid for use with the WebAssembly.Function ctor, which
// is not yet documented on MDN.
// is not yet documented on MDN.
sigToWasm: function(sig){
const rc = {parameters:[], results: []};
if('v'!==sig[0]) rc.results.push(f.sigTypes(sig[0]));
@ -1581,10 +1581,20 @@ self.WhWasmUtilInstaller = function(target){
not actually bind any functions. Its convertArg() method is
called via xWrap() to perform any bindings.
Shortcomings: function pointers which include C-string arguments
may still need a level of hand-written wrappers around them,
depending on how they're used, in order to provide the client
with JS strings.
Shortcomings:
- These "reverse" bindings, i.e. calling into a JS-defined
function from a WASM-defined function (the generated proxy
wrapper), lack all type conversion support. That means, for
example, that...
- Function pointers which include C-string arguments may still
need a level of hand-written wrappers around them, depending on
how they're used, in order to provide the client with JS
strings. Alternately, clients will need to perform such conversions
on their own, e.g. using cstrtojs(). Or maybe we can find a way
to perform such conversions here, via addition of an xWrap()-style
function signature to the options argument.
*/
xArg.FuncPtrAdapter = class FuncPtrAdapter extends AbstractArgAdapter {
constructor(opt) {