/* else fall through */
default:
//console.log("isSupportedBindType",t,v);
- return util.isBindableTypedArray(v) ? BindTypes.blob : undefined;
+ return (util.isBindableTypedArray(v) || (v instanceof ArrayBuffer))
+ ? BindTypes.blob : undefined;
}
};
case BindTypes.blob: {
if('string'===typeof val){
rc = f._.string(stmt, ndx, val, true);
+ break;
+ }else if(val instanceof ArrayBuffer){
+ val = new Uint8Array(val);
}else if(!util.isBindableTypedArray(val)){
toss3("Binding a value as a blob requires",
- "that it be a string, Uint8Array, or Int8Array.");
- }else{
- const stack = wasm.scopedAllocPush();
- try{
- const pBlob = wasm.scopedAlloc(val.byteLength || 1);
- wasm.heap8().set(val.byteLength ? val : [0], pBlob)
- rc = capi.sqlite3_bind_blob(stmt.pointer, ndx, pBlob, val.byteLength,
- capi.SQLITE_TRANSIENT);
- }finally{
- wasm.scopedAllocPop(stack);
- }
+ "that it be a string, Uint8Array, Int8Array, or ArrayBuffer.");
+ }
+ const stack = wasm.scopedAllocPush();
+ try{
+ const pBlob = wasm.scopedAlloc(val.byteLength || 1);
+ wasm.heap8().set(val.byteLength ? val : [0], pBlob)
+ rc = capi.sqlite3_bind_blob(stmt.pointer, ndx, pBlob, val.byteLength,
+ capi.SQLITE_TRANSIENT);
+ }finally{
+ wasm.scopedAllocPop(stack);
}
break;
}
toss3("Unsupported bind() argument type: "+(typeof val));
}
if(rc) DB.checkRc(stmt.db.pointer, rc);
+ stmt._mayGet = false;
return stmt;
};
- Strings are bound as strings (use bindAsBlob() to force
blob binding).
- - Uint8Array and Int8Array instances are bound as blobs.
- (TODO: binding the other TypedArray types.)
+ - Uint8Array, Int8Array, and ArrayBuffer instances are bound as
+ blobs. (TODO? binding the other TypedArray types.)
If passed an array, each element of the array is bound at
the parameter index equal to the array index plus 1
}
arg.forEach((v,i)=>bindOne(this, i+1, affirmSupportedBindType(v), v));
return this;
+ }else if(arg instanceof ArrayBuffer){
+ arg = new Uint8Array(arg);
}
- else if('object'===typeof arg/*null was checked above*/
+ if('object'===typeof arg/*null was checked above*/
&& !util.isBindableTypedArray(arg)){
/* Treat each property of arg as a named bound parameter. */
if(1!==arguments.length){
the value. The ndx may be a numbered or named bind index. The
value must be of type string, null/undefined (both get treated
as null), or a TypedArray of a type supported by the bind()
- API.
+ API. This API cannot bind numbers as blobs.
If passed a single argument, a bind index of 1 is assumed and
the first argument is the value.
&& BindTypes.null !== t){
toss3("Invalid value type for bindAsBlob()");
}
- bindOne(this, ndx, BindTypes.blob, arg);
- this._mayGet = false;
- return this;
+ return bindOne(this, ndx, BindTypes.blob, arg);
},
/**
Steps the statement one time. If the result indicates that a
-C Add\sa\stest\sfor\sthe\s(failure)\scase\sof\sclient-level\scode\scalling\sthe\soo1.Stmt\sconstructor\sdirectly.
-D 2022-12-24T13:46:27.601
+C Extend\soo1.Stmt.bind()\sto\saccept\sArrayBuffer\sinstances\sto\sbind\sas\sblobs.
+D 2022-12-24T14:16:02.217
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
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 f0651048a2601bf79f7f39c2c855f6417e65548417f5019ac9ac2ffb2463f2b9
-F ext/wasm/api/sqlite3-api-oo1.js 485f43129b25b939209effcec635e801bad75bf0a534c7ca327a7cd934744163
+F ext/wasm/api/sqlite3-api-oo1.js 1312eaf2776c957e41a6fd63c31e7487502bf71745805c41f72429e0925802a5
F ext/wasm/api/sqlite3-api-prologue.js 683956ea6ab5e0132db48bb693a6bb9dd92f36c8c0902af36572e9b29006ac6d
F ext/wasm/api/sqlite3-api-worker1.js e94ba98e44afccfa482874cd9acb325883ade50ed1f9f9526beb9de1711f182f
F ext/wasm/api/sqlite3-license-version-header.js a661182fc93fc2cf212dfd0b987f8e138a3ac98f850b1112e29b5fbdaecc87c3
F ext/wasm/test-opfs-vfs.js f09266873e1a34d9bdb6d3981ec8c9e382f31f215c9fd2f9016d2394b8ae9b7b
F ext/wasm/tester1-worker.html d43f3c131d88f10d00aff3e328fed13c858d674ea2ff1ff90225506137f85aa9
F ext/wasm/tester1.c-pp.html d34bef3d48e5cbc1c7c06882ad240fec49bf88f5f65696cc2c72c416933aa406
-F ext/wasm/tester1.c-pp.js d395eb6aaf4de79bf2c027f7c4b5e4ae007ee1822d6e064e946d0305672a9761
+F ext/wasm/tester1.c-pp.js 145c493221727eb40194280bb2852da49f857e850d8394c31b7bd4caeb5d7bed
F ext/wasm/tests/opfs/concurrency/index.html 86d8ac435074d1e7007b91105f4897f368c165e8cecb6a9aa3d81f5cf5dcbe70
F ext/wasm/tests/opfs/concurrency/test.js a98016113eaf71e81ddbf71655aa29b0fed9a8b79a3cdd3620d1658eb1cc9a5d
F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 0b2df22bd92914708ad0851d0401ad2cf3edb1968b88b2c07fe40792a731c5ba
-R 56f356985466274ad72950f0668d6b94
+P 6a37874db04f3b4842994ad17fc74cb6222f8ea0fa1315a23aff1ffa69bcd12a
+R b07f6a4d9e30a3f649f5decc82bdf7ef
U stephan
-Z bfd3bc98ed13225718cba2333de93b83
+Z 934cef85bd1b053ac09da3261d128afb
# Remove this line to create a well-formed Fossil manifest.