1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Document sqlite3.capi.sqlite3_prepare_v3() as accepting an ArrayBuffer and ensure that it can.

FossilOrigin-Name: ae3ae92ec45d3d5de92e70876502f8108fc3fcd87848e86c2b83f8842f1ff139
This commit is contained in:
stephan
2022-12-26 15:08:48 +00:00
parent d9cfd0f339
commit 64fa85bb5e
4 changed files with 16 additions and 14 deletions

View File

@ -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;