aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/api/sqlite3-api-oo1.js
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2022-12-23 23:46:33 +0000
committerstephan <stephan@noemail.net>2022-12-23 23:46:33 +0000
commit027afccdcd6e9077b7043545a3f8bd32cfb5a397 (patch)
tree261b5266a2f496a039c349a9ce334413894538bb /ext/wasm/api/sqlite3-api-oo1.js
parentab9c2d571e5927060c65d7bfd3132348f6240159 (diff)
downloadsqlite-027afccdcd6e9077b7043545a3f8bd32cfb5a397.tar.gz
sqlite-027afccdcd6e9077b7043545a3f8bd32cfb5a397.zip
Reimplement JS's sqlite3_bind_text/blob() with hand-written bindings to permit more flexible inputs. Add automated JS-to-C function conversion to sqlite3_busy_handler(). sqlite3.wasm.xWrap()'s '*' argument conversion no longer treats JS strings as C-strings: those conversions require explicit opt-in via the 'string' converter (or equivalent).
FossilOrigin-Name: 96ba44946b3e88b6aa305c4363cbbfeab0d9120b3d8c4d2587d68b9293ea7cc6
Diffstat (limited to 'ext/wasm/api/sqlite3-api-oo1.js')
-rw-r--r--ext/wasm/api/sqlite3-api-oo1.js11
1 files changed, 1 insertions, 10 deletions
diff --git a/ext/wasm/api/sqlite3-api-oo1.js b/ext/wasm/api/sqlite3-api-oo1.js
index 1776cb327..ddb346e54 100644
--- a/ext/wasm/api/sqlite3-api-oo1.js
+++ b/ext/wasm/api/sqlite3-api-oo1.js
@@ -1332,8 +1332,7 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
}else if(!util.isBindableTypedArray(val)){
toss3("Binding a value as a blob requires",
"that it be a string, Uint8Array, or Int8Array.");
- }else if(1){
- /* _Hypothetically_ more efficient than the impl in the 'else' block. */
+ }else{
const stack = wasm.scopedAllocPush();
try{
const pBlob = wasm.scopedAlloc(val.byteLength || 1);
@@ -1343,14 +1342,6 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
}finally{
wasm.scopedAllocPop(stack);
}
- }else{
- const pBlob = wasm.allocFromTypedArray(val);
- try{
- rc = capi.sqlite3_bind_blob(stmt.pointer, ndx, pBlob, val.byteLength,
- capi.SQLITE_TRANSIENT);
- }finally{
- wasm.dealloc(pBlob);
- }
}
break;
}