mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-27 20:41:58 +03:00
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
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user