aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/api
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2022-12-26 14:55:00 +0000
committerstephan <stephan@noemail.net>2022-12-26 14:55:00 +0000
commitd9cfd0f339e4ca30981eb7dc44724480710cc48e (patch)
tree367c238bf6b320c19cff7c1ffc8411477a533572 /ext/wasm/api
parent67e4f6fcdb00a005f41e9dc877ec85d45a20b887 (diff)
downloadsqlite-d9cfd0f339e4ca30981eb7dc44724480710cc48e.tar.gz
sqlite-d9cfd0f339e4ca30981eb7dc44724480710cc48e.zip
Correct some internal-use JS docs and update the 'string:flexible' type conversion to accept an ArrayBuffer (as it was recently documented to).
FossilOrigin-Name: eff5d3bec29043cc1182bbb5229040dac5ff50264d025e354736bb63b4bc97a0
Diffstat (limited to 'ext/wasm/api')
-rw-r--r--ext/wasm/api/sqlite3-api-oo1.js6
-rw-r--r--ext/wasm/api/sqlite3-api-prologue.js10
2 files changed, 9 insertions, 7 deletions
diff --git a/ext/wasm/api/sqlite3-api-oo1.js b/ext/wasm/api/sqlite3-api-oo1.js
index 965f7ee93..f72def751 100644
--- a/ext/wasm/api/sqlite3-api-oo1.js
+++ b/ext/wasm/api/sqlite3-api-oo1.js
@@ -1246,9 +1246,7 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
if(wasm.bigIntEnabled) return t;
/* else fall through */
default:
- //console.log("isSupportedBindType",t,v);
- return (util.isBindableTypedArray(v) || (v instanceof ArrayBuffer))
- ? BindTypes.blob : undefined;
+ return util.isBindableTypedArray(v) ? BindTypes.blob : undefined;
}
};
@@ -1466,7 +1464,7 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
blob binding).
- Uint8Array, Int8Array, and ArrayBuffer instances are bound as
- blobs. (TODO? binding the other TypedArray types.)
+ blobs.
If passed an array, each element of the array is bound at
the parameter index equal to the array index plus 1
diff --git a/ext/wasm/api/sqlite3-api-prologue.js b/ext/wasm/api/sqlite3-api-prologue.js
index ff528feef..acf66b6e2 100644
--- a/ext/wasm/api/sqlite3-api-prologue.js
+++ b/ext/wasm/api/sqlite3-api-prologue.js
@@ -321,7 +321,7 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
};
/**
- Returns v if v appears to be one of our bind()-able TypedArray
+ Returns true if v appears to be one of our bind()-able TypedArray
types: Uint8Array or Int8Array or ArrayBuffer. Support for
TypedArrays with element sizes >1 is a potential TODO just
waiting on a use case to justify them. Until then, their `buffer`
@@ -377,7 +377,11 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
returned. Else v is returned as-is.
*/
const flexibleString = function(v){
- if(isSQLableTypedArray(v)) return typedArrayToString(v);
+ if(isSQLableTypedArray(v)){
+ return typedArrayToString(
+ (v instanceof ArrayBuffer) ? new Uint8Array(v) : v
+ );
+ }
else if(Array.isArray(v)) return v.join("");
else if(wasm.isPtr(v)) v = wasm.cstrToJs(v);
return v;
@@ -751,7 +755,7 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
affirmBindableTypedArray, flexibleString,
bigIntFits32, bigIntFits64, bigIntFitsDouble,
isBindableTypedArray,
- isInt32, isSQLableTypedArray, isTypedArray,
+ isInt32, isSQLableTypedArray, isTypedArray,
typedArrayToString,
isUIThread: ()=>(self.window===self && !!self.document),
// is this true for ESM?: 'undefined'===typeof WorkerGlobalScope