aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/api
diff options
context:
space:
mode:
Diffstat (limited to 'ext/wasm/api')
-rw-r--r--ext/wasm/api/sqlite3-api-glue.js10
-rw-r--r--ext/wasm/api/sqlite3-api-prologue.js4
2 files changed, 8 insertions, 6 deletions
diff --git a/ext/wasm/api/sqlite3-api-glue.js b/ext/wasm/api/sqlite3-api-glue.js
index f4c67eac8..cef27b548 100644
--- a/ext/wasm/api/sqlite3-api-glue.js
+++ b/ext/wasm/api/sqlite3-api-glue.js
@@ -1146,16 +1146,18 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
/**
Helper for string:flexible conversions which require a
byte-length counterpart argument. Passed a value and its
- ostensible length, this function returns [V,N], where V
- is either v or a transformed copy of v and N is either n,
- -1, or the byte length of v (if it's a byte array).
+ ostensible length, this function returns [V,N], where V is
+ either v or a transformed copy of v and N is either n, -1, or
+ the byte length of v (if it's a byte array or ArrayBuffer).
*/
const __flexiString = (v,n)=>{
if('string'===typeof v){
n = -1;
}else if(util.isSQLableTypedArray(v)){
n = v.byteLength;
- v = util.typedArrayToString(v);
+ v = util.typedArrayToString(
+ (v instanceof ArrayBuffer) ? new Uint8Array(v) : v
+ );
}else if(Array.isArray(v)){
v = v.join("");
n = -1;
diff --git a/ext/wasm/api/sqlite3-api-prologue.js b/ext/wasm/api/sqlite3-api-prologue.js
index acf66b6e2..cae268996 100644
--- a/ext/wasm/api/sqlite3-api-prologue.js
+++ b/ext/wasm/api/sqlite3-api-prologue.js
@@ -662,8 +662,8 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
terminated with a 0 byte.
In usage (1), the 2nd argument must be of type string,
- Uint8Array, or Int8Array (either of which is assumed to
- hold SQL). If it is, this function assumes case (1) and
+ Uint8Array, Int8Array, or ArrayBuffer (all of which are assumed
+ to hold SQL). If it is, this function assumes case (1) and
calls the underyling C function with the equivalent of:
(pDb, sqlAsString, -1, prepFlags, ppStmt, null)