aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/api/sqlite3-api-glue.js
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2022-12-05 13:12:48 +0000
committerstephan <stephan@noemail.net>2022-12-05 13:12:48 +0000
commit9a49a97487c93708a0b720aae39b4123e9a02715 (patch)
tree456230b35a54cf32904169670ef71782b62229b0 /ext/wasm/api/sqlite3-api-glue.js
parentcf8f0d20463adf368cedb434d6d70cd255ab185a (diff)
downloadsqlite-9a49a97487c93708a0b720aae39b4123e9a02715.tar.gz
sqlite-9a49a97487c93708a0b720aae39b4123e9a02715.zip
Export sqlite3_vtab_collation() to wasm. Rename 'flexible-string' JS argument adapter to 'string:flexible' for consistency.
FossilOrigin-Name: 15f8042fddaeabab43dd187c463d3ccc56758cbf19bf2ca4837d9087a4850c1a
Diffstat (limited to 'ext/wasm/api/sqlite3-api-glue.js')
-rw-r--r--ext/wasm/api/sqlite3-api-glue.js46
1 files changed, 23 insertions, 23 deletions
diff --git a/ext/wasm/api/sqlite3-api-glue.js b/ext/wasm/api/sqlite3-api-glue.js
index b460093f8..ddfc1daf4 100644
--- a/ext/wasm/api/sqlite3-api-glue.js
+++ b/ext/wasm/api/sqlite3-api-glue.js
@@ -38,10 +38,10 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
delete self.Jaccwabyt;
{/* Convert Arrays and certain TypedArrays to strings for
- 'flexible-string'-type arguments */
+ 'string:flexible'-type arguments */
const xString = wasm.xWrap.argAdapter('string');
wasm.xWrap.argAdapter(
- 'flexible-string', (v)=>xString(util.flexibleString(v))
+ 'string:flexible', (v)=>xString(util.flexibleString(v))
);
/**
@@ -176,29 +176,9 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
(1===n?"":'s')+".");
};
- /**
- Helper for flexible-string 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).
- */
- const __flexiString = function(v,n){
- if('string'===typeof v){
- n = -1;
- }else if(util.isSQLableTypedArray(v)){
- n = v.byteLength;
- v = util.typedArrayToString(v);
- }else if(Array.isArray(v)){
- v = v.join("");
- n = -1;
- }
- return [v, n];
- };
-
if(1){/* Special-case handling of sqlite3_exec() */
const __exec = wasm.xWrap("sqlite3_exec", "int",
- ["sqlite3*", "flexible-string", "*", "*", "**"]);
+ ["sqlite3*", "string:flexible", "*", "*", "**"]);
/* Documented in the api object's initializer. */
capi.sqlite3_exec = function f(pDb, sql, callback, pVoid, pErrMsg){
if(f.length!==arguments.length){
@@ -550,6 +530,26 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
if(1){/* Special-case handling of sqlite3_prepare_v2() and
sqlite3_prepare_v3() */
/**
+ 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).
+ */
+ const __flexiString = (v,n)=>{
+ if('string'===typeof v){
+ n = -1;
+ }else if(util.isSQLableTypedArray(v)){
+ n = v.byteLength;
+ v = util.typedArrayToString(v);
+ }else if(Array.isArray(v)){
+ v = v.join("");
+ n = -1;
+ }
+ return [v, n];
+ };
+
+ /**
Scope-local holder of the two impls of sqlite3_prepare_v2/v3().
*/
const __prepare = Object.create(null);