aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/api/sqlite3-api-glue.js
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2022-09-26 11:38:58 +0000
committerstephan <stephan@noemail.net>2022-09-26 11:38:58 +0000
commit1f095d482d1803deb9fcb60449e9ca1223018d73 (patch)
treeee83c502c48008460a89a0aaab2adcc728c7c69b /ext/wasm/api/sqlite3-api-glue.js
parent6a643e4bcdc81f835be75377d1c6306f5e23f541 (diff)
downloadsqlite-1f095d482d1803deb9fcb60449e9ca1223018d73.tar.gz
sqlite-1f095d482d1803deb9fcb60449e9ca1223018d73.zip
Get fiddle db export working for OPFS VFS. Add root dir handle to the main OPFS VFS worker to enable creation of certain utility functions without delegating to the async worker. Add sqlite3.capi.sqlite3_wasm_rc_str() to map integer result codes back to their SQLITE_xxx counterparts. Minor doc touchups.
FossilOrigin-Name: 9b2244e1c8a40efe6547094a1b57acc8f2173145a8731abb0e36268ce0a8ef41
Diffstat (limited to 'ext/wasm/api/sqlite3-api-glue.js')
-rw-r--r--ext/wasm/api/sqlite3-api-glue.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/ext/wasm/api/sqlite3-api-glue.js b/ext/wasm/api/sqlite3-api-glue.js
index 847bf7bc2..49f736669 100644
--- a/ext/wasm/api/sqlite3-api-glue.js
+++ b/ext/wasm/api/sqlite3-api-glue.js
@@ -185,9 +185,20 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
capi[e[0]] = e[1];
}
}
+ const __rcMap = Object.create(null);
+ for(const t of ['resultCodes']){
+ for(const e of Object.entries(wasm.ctype[t])){
+ __rcMap[e[1]] = e[0];
+ }
+ }
+ /**
+ For the given integer, returns the SQLITE_xxx result code as a
+ string, or undefined if no such mapping is found.
+ */
+ capi.sqlite3_wasm_rc_str = (rc)=>__rcMap[rc];
/* Bind all registered C-side structs... */
for(const s of wasm.ctype.structs){
capi[s.name] = sqlite3.StructBinder(s);
}
- }
+ }/*end C constant imports*/
});