aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/api/sqlite3-wasm.c
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2024-04-22 16:46:37 +0000
committerstephan <stephan@noemail.net>2024-04-22 16:46:37 +0000
commit0a42e9913b233d433bd526c4c76825d0e1785bb6 (patch)
tree473dc01375481021f4bfec3515545e536b8f9eef /ext/wasm/api/sqlite3-wasm.c
parent4f2f6c74cab89f6075bc77e1ea0ba128ee8f91bf (diff)
downloadsqlite-0a42e9913b233d433bd526c4c76825d0e1785bb6.tar.gz
sqlite-0a42e9913b233d433bd526c4c76825d0e1785bb6.zip
Extend the JS/WASM SEE build support by (A) filtering SEE-related bits out of the JS when not building with SEE and (B) accepting an optional key/textkey/hexkey option to the sqlite3.oo1.DB and subclass constructors to create/open SEE-encrypted databases with. Demonstrate SEE in the test app using the kvvfs. This obviates the changes made in [5c505ee8a7].
FossilOrigin-Name: 8fbda563d2f56f8dd3f695a5711e4356de79035f332270db45d4b33ed52fdfd2
Diffstat (limited to 'ext/wasm/api/sqlite3-wasm.c')
-rw-r--r--ext/wasm/api/sqlite3-wasm.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/ext/wasm/api/sqlite3-wasm.c b/ext/wasm/api/sqlite3-wasm.c
index cc1db6723..d315b43d6 100644
--- a/ext/wasm/api/sqlite3-wasm.c
+++ b/ext/wasm/api/sqlite3-wasm.c
@@ -1678,6 +1678,25 @@ int sqlite3__wasm_config_j(int op, sqlite3_int64 arg){
return sqlite3_config(op, arg);
}
+/*
+** This function is NOT part of the sqlite3 public API. It is strictly
+** for use by the sqlite project's own JS/WASM bindings.
+**
+** If z is not NULL, returns the result of passing z to
+** sqlite3_mprintf()'s %Q modifier (if addQuotes is true) or %q (if
+** addQuotes is 0). Returns NULL if z is NULL or on OOM.
+*/
+SQLITE_WASM_EXPORT
+char * sqlite3__wasm_qfmt_token(char *z, int addQuotes){
+ char * rc = 0;
+ if( z ){
+ rc = addQuotes
+ ? sqlite3_mprintf("%Q", z)
+ : sqlite3_mprintf("%q", z);
+ }
+ return rc;
+}
+
#if 0
// Pending removal after verification of a workaround discussed in the
// forum post linked to below.