aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/api/sqlite3-api-glue.js
Commit message (Collapse)AuthorAge
* Internal JS doc cleanups.stephan2024-01-11
| | | FossilOrigin-Name: c8284170f66374fc528e9d6e5a03ee7321f27e80acf4360701a8b176497b7130
* Split the JS vfs/vtab helper code into discreet units as a step towards a ↵stephan2024-01-11
| | | | | build which optionally elides those pieces. This is an internal restructuring change and does not affect the API. FossilOrigin-Name: ede945fd2360097d9961b8a4b8fb48fea57399cb9163534ed1c3c6b86588b0a5
* Make explicit which JS APIs are for internal use only by moving the JS-bound ↵stephan2024-01-08
| | | | | internal-use-only functions out of client-visible reach and renaming the WASM-exported ones from sqlite3_wasm... to sqlite3__wasm... (with two underscores). These have always been documented as internal-use-only, so this is not a breaking change except for clients which have ignored the docs. FossilOrigin-Name: 0eddc20f37988df6bce5f407b69e4a315e5cca4af104586e6fe942f0d656cccd
* Export sqlite3_get_autocommit() to WASM and add tests for it.stephan2023-10-27
| | | FossilOrigin-Name: 7cb6d3cd3926882240c91a4b90fdf237b931653295d8d94b05ed885dcae59608
* Correct an undefined-value deref in the JS bindings, triggered by passing ↵stephan2023-09-30
| | | | | invalid args and then tripping over an undefined value while trying to report that. Reported in [forum:dd42df144651d779|forum post dd42df144651d779]. FossilOrigin-Name: fd4632540717c4771ac9ae1fe4400091a2cd0553639bf809abaf4ecbc54de4f0
* Add sqlite3.capi.sqlite3_js_posix_create_file() and oo1.OpfsDb.importDb() as ↵stephan2023-08-11
| | | | | alternatives for the newly-deprecated sqlite3_js_vfs_create_file(). FossilOrigin-Name: da6eaf8d8258f3e2c8633fd7faf4e90c3307b5c60bd8b69c626b3c82b19dbdef
* Dynamically determine whether the wasm.xWrap() argc check can be applied, ↵stephan2023-07-27
| | | | | depending on how the wasm environment exposes its exports. FossilOrigin-Name: fd59226b34fffb1479fb2d7bd7c0aff982aa4a1a73e6c0d81de6eaf9c075998c
* Extend wasm build to support a custom sqlite3.c to support building against ↵stephan2023-03-08
| | | | | sqlite3-see.c. The JS code now binds the SEE-specific functions if it detects an SEE build. FossilOrigin-Name: dd8612c8adbaf9d06bf0d7319b9afc9bd8ca3d0fcfa1cb591a7a2fcb86480048
* Replace use of 'self' in JS code with 'globalThis', as that works in ↵stephan2023-03-07
| | | | | browsers and node environments. Avoid using globalThis.location if it's not set (e.g. in node). Based on feedback in [forum:ac7a94d4f77db235|forum post ac7a94d4f77db235]. Minor JS build tweaks. FossilOrigin-Name: dbbe8f25e58738c10b6192d41f1e3886983871f17631cbc45ce626d3f05a6e26
* Remove the JS-side SQLITE_WASM_DEALLOC sanity check which triggers the ↵stephan2023-01-04
| | | | | problem mentioned in [688c5c13d156] and [ae0196d86ee8], for reasons covered in the code comments, per discussion in [forum:e5b20e1feb|forum post e5b20e1feb]. FossilOrigin-Name: 65ff3200c6009a1649fc108d7ce36f5c014185ba46bbf98471ec86eaeb572656
* Another reformulation of SQLITE_WASM_DEALLOC to attempt to work around a ↵stephan2023-01-02
| | | | | Safari-specific quirk reported in [forum:5489305f601b8c3f|forum post 5489305f601b8c3f]. FossilOrigin-Name: ae0196d86ee8ca424b5ef5a43c32988f4ab5131ea146669bc1467e31a2384901
* An alternative solution to mapping SQLITE_WASM_DEALLOC to the proper ↵stephan2023-01-01
| | | | | function pointer in JS, to account for a Safari-specific quirk reported in [forum:e5b20e1feb|forum post e5b20e1feb]. FossilOrigin-Name: 688c5c13d156f987b895df1d5a5b770616b0d9caec4726e03ba122eb8539e7b2
* Expose sqlite3_preupdate_hook() and friends to the JS API.stephan2022-12-27
| | | FossilOrigin-Name: cc02783a1210a083683320fae1ec1519e45b8e3003a9e32809d808513a2ce06b
* Expose sqlite3_commit/rollback/update_hook() to JS API.stephan2022-12-27
| | | FossilOrigin-Name: f99f8e3ecfe205337996ee61c0b9f139d3e8788b14f32e26560888b3a16564de
* Expose the auto-extension API to JS and reorganize some nearby code.stephan2022-12-26
| | | FossilOrigin-Name: 52b229d11d82bfb81c8b63e252c51c57a34dc50498dd685451588c185873c628
* Document sqlite3.capi.sqlite3_prepare_v3() as accepting an ArrayBuffer and ↵stephan2022-12-26
| | | | | ensure that it can. FossilOrigin-Name: ae3ae92ec45d3d5de92e70876502f8108fc3fcd87848e86c2b83f8842f1ff139
* Only add an on-db-close cleanup entry for collations if adding the collation ↵stephan2022-12-26
| | | | | succeeds and xCompare is-a JS function. FossilOrigin-Name: 18a5480f1e0dca55703b43fa17685a4cc577cab8841ce47c807af02348ad85ee
* Extend [0e69b2c379e618] to support uninstalling stale JS-to-WASM function ↵stephan2022-12-26
| | | | | pointers added on behalf of UDFs. FossilOrigin-Name: 7a46e629dcbf97ae037c5abb39306af7ad55f1910c1e962373e09d88d8bd5a33
* Add JS infrastructure which enables sqlite3.capi.sqlite3_close_v2() to clean ↵stephan2022-12-26
| | | | | up stale JS-to-WASM collation function conversions installed on behalf of a given db handle. The same for UDF mappings is TODO. FossilOrigin-Name: 0e69b2c379e61893c7db8a9c9d270650f2bd63b6cea30811d41136392a2e4f04
* Reimplement sqlite3.capi.sqlite3_close_v2() and sqlite3session_delete() as a ↵stephan2022-12-26
| | | | | hand-written bindings so that they can attempt to clean up certain (potentially) FuncPtrAdapter-installed functions before closing. Correct the create-function family of JS-to-function-pointer automated conversions to include the UDF's arity as part of the mapping's key so that (un)binding a UDF to different functions for different arities works (and add tests confirming it). Correct a broken doc link in module-symbols.html. FossilOrigin-Name: 60b262ef0f57b162c2566b12e70685a92afb00b441332ea7a6540fcb188cc7af
* Merge wasm-session-api branch into trunk, adding the session API to the ↵stephan2022-12-25
|\ | | | | | | | | JS/WASM components. FossilOrigin-Name: dfb8b651fa4faef2d3307a05512cdc479398484c3a59715827179c363861a777
| * Remove duplicated JS binding of sqlite3changeset_apply_v2().stephan2022-12-25
| | | | | | FossilOrigin-Name: 2e8336b6e1cba89dbcc11d6316e39c929bf8b018a18b92efc232abd47e0a5cc6
| * Update the session-related JS bindings to account for today's internal API ↵stephan2022-12-25
| | | | | | | | | | changes. FossilOrigin-Name: be63944d4114f53f2dab65bc6c1b85f4766a4ea14ee7b2690acde239a2a0bf54
| * Merge trunk into wasm-session-api branch.stephan2022-12-25
| |\ | | | | | | FossilOrigin-Name: 7f8f1acd82be7dc2eb2147d96299b1b443e86774dfe0b0a8d32669a0500fc9c6
| * \ Merge trunk into wasm-session-api branch.stephan2022-12-23
| |\ \ | | | | | | | | FossilOrigin-Name: 6cdb036d8e8c5ddb0c6578aeefe318e74d7a90228e57b9f9047057dae3252963
| * \ \ Merge trunk into wasm-session-api branch.stephan2022-12-23
| |\ \ \ | | | | | | | | | | FossilOrigin-Name: f1decc831fe0dc8523956e74474d9663852b0e5b56240dd8504952726e713a97
| * | | | Add sqlite3.capi JS bindings for the sqlite3session_...(), ↵stephan2022-12-23
| | | | | | | | | | | | | | | | | | | | | | | | | sqlite3changeset_...() and sqlite3changegroup_...() APIs, noting that they are completely untested. Aside from missing tests, these bindings reveal a slight string-argument-type shortcoming in the callback function pointer "reverse binding" which should ideally be resolved before publishing them. FossilOrigin-Name: 0a39172ee134816f5ce17a403b960e9c22bb56efd5bcf77ecde465efe0d88b1d
| * | | | Initial pieces for binding the session API to JS. Far from complete. See ↵stephan2022-12-23
| | | | | | | | | | | | | | | | | | | | | | | | | [forum:210e36a1e3 | forum post 210e36a1e3] for the discussion. FossilOrigin-Name: cd8c100808da1043fcf63555f48f30c90272c48c6627321ceb0a0995b34733d1
* | | | | Replace the "manual" implementation of sqlite3.capi.sqlite3_exec() with a ↵stephan2022-12-25
| |_|_|/ |/| | | | | | | | | | | | | | | briefer "automated" one via the [7f9ace1b11a67] feature addition. Minor code-adjacent internal cleanups. FossilOrigin-Name: 4888957baf18c6763f959fbba998a74156ff656368779107f502b926e9e9d949
* | | | Add missing sqlite3_context_db_handle() JS binding. Reimplement ↵stephan2022-12-25
| | | | | | | | | | | | | | | | | | | | sqlite3_set_authorizer() and sqlite3_set_auxdata() JS bindings to take advantage of [7f9ace1b11a67]. Teach FuncPtrAdapter to emit a console.warn() message if it is invoked after the library is bootstrapped, the goal being to inform users that it's an internal API and should not be invoked from client-side code. FossilOrigin-Name: 8e3d4f6294037396e388ec21abb18bf0201a6bec6ff004730cc5d11b705a6d2b
* | | | Enhance sqlite3.wasm.xWrap.FuncPtrAdapter to be able to handle ↵stephan2022-12-25
| | | | | | | | | | | | | | | | | | | | sqlite3_create_function() and friends and reimplement those bindings to use this feature (this will also simplify certain session API bindings). Interal API changes only with no client-side breakage. FossilOrigin-Name: 7f9ace1b11a6703031790af9cf08ab25df25850a86e6ca2a7aeaefd8aa395e6d
* | | | Simplify the signature for JS functions, as opposed to function pointers, ↵stephan2022-12-25
| | | | | | | | | | | | | | | | | | | | passed to sqlite3_exec(), eliminating the superfluous initial two arguments. Update related tests to demonstrate both function-passing approaches. FossilOrigin-Name: e7cc70cdda426863f82ebe1305f4c3053824c5a605b1516b0b7f205f1203178b
* | | | Replace JS-side use of SQLITE_TRANSIENT with the new SQLITE_WASM_DEALLOC, ↵stephan2022-12-24
| | | | | | | | | | | | | | | | | | | | reducing the amount allocation/copying required by sqlite3_bind_blob/text() and sqlite3_result_blob/text(). Remove the 'experimental' log message from the virtual table tests. FossilOrigin-Name: ffe2999a91a7dec129a38afb675fe9e539d7c347886bfea85cba55f6367d54d1
* | | | Reimplement JS's sqlite3_bind_text/blob() with hand-written bindings to ↵stephan2022-12-23
| |_|/ |/| | | | | | | | | | | 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
* | | Internal JS cleanups. Correct part of [ac136925a645] to account for the ↵stephan2022-12-23
| |/ |/| | | | | | | eTextRep flag being able to hold flags other than the encoding. FossilOrigin-Name: 1dfc03ab1e0269807beef27bf884ab9ead7553d4a5f6ed213f812d7fa052045f
* | Consolidate/unify how the JS bindings of the create_function/collation ↵stephan2022-12-23
|/ | | | | family of functions react to a non-UTF8 encoding: they now treat a falsy value as SQLITE_UTF8 and fail with SQLITE_FORMAT for an invalid encoding. FossilOrigin-Name: deffe6fb211410fa1a1fbca824a52b4e09b54d4b4f4a4e12d71c9e4b7e8606fb
* Expose a JS-friendly subset of sqlite3_config() to JS, with the notable ↵stephan2022-12-16
| | | | | caveats that (1) setting up the JS bindings requires starting the library, making sqlite3_config() illegal to call and (2) calling sqlite3_shutdown() in order to make it legal to call sqlite3_config() may undo certain JS-side library initialization. Move sqlite3_(de)serialize() into the int64-mode-only bindings because of their int64 args. FossilOrigin-Name: 62e0c931ac952219f68e22d64e20836781bf330b4581e4662266172a97c9289b
* Add sqlite3_set_authorizer() support and related tests to JS.stephan2022-12-16
| | | FossilOrigin-Name: 551b848894c249cb3c9d237643d2ed53ffcb3b003d0cf3f797a535df1731ce39
* Internal refactoring of how sqlite3.wasm.xWrap() handles JS-to-C function ↵stephan2022-12-15
| | | | | pointer conversions, to enable similar conversions to be added more easily. FossilOrigin-Name: 10cfe3fae6f680d3ecc3b0afbbf628ce91e34e3757b19dd27c231f0daf44232a
* Add convenience variants of sqlite3.wasm.peek/poke() for each numeric type ↵stephan2022-12-14
| | | | | to help reduce errors related to typos in the final argument (type-name strings). If wasm.xWrap.FuncPtrAdapter is called as a function, instead of a constructor, it now behaves as if it were called as a constructor (previously it threw an exception). FossilOrigin-Name: 14e3fc01b929fa3f9a2fdbd93deb4a8aad58c111d46369c772def0437152fa75
* Extend the sqlite3.wasm function pointer argument converter to be able to ↵stephan2022-12-13
| | | | | handle the "two-layered context" of sqlite3_create_collation() and friends and make use of FuncPtrAdapter to perform JS-to-WASM function conversion for them. FossilOrigin-Name: 0a60b7215e433f8c50027c70731b11e58d74c90ec5903e66ae42f9c98e40b044
* Revert part of [9386d6f63468] because the new automatic function pointer ↵stephan2022-12-12
| | | | | binding cannot properly track per-context function mappings when the context is more complex than a single context-type pointer. e.g. it is fine for sqlite3_trace_v2() but it breaks down with sqlite3_create_collation() because that one needs to use the collation name as part of the context key and we cannot sensibly do so with the current code. FossilOrigin-Name: 6cd21b79075367227b57bccf829cc7d4ccc7d7fbcfaed226b4c8e942ddae4eb6
* Move JS-to-C binding signatures from sqlite3-api-prologue.js to ↵stephan2022-12-12
| | | | | sqlite3-api-glue.js to allow for use of the new/experimental sqlite3.wasm.xWrap() feature which automatically binds JS functions to WASM/C as needed, which simplifies creation of bindings which take C function pointers. Reimplement sqlite3_exec(), sqlite3_create_collation(), sqlite3_progress_handler() to use this new feature. FossilOrigin-Name: 9386d6f634680b4e0fa5487c34c63acb29f0b7a6ae738b8f6164ad084a229b62
* Expose sqlite3_txn_state() to wasm.stephan2022-12-12
| | | FossilOrigin-Name: f6f3397a4667b15a96bdf4189c54789d622fd90351405e963d7f56ac93a9344c
* Refactor the internal JS routines for converting UDF results and errors to ↵stephan2022-12-10
| | | | | JS into public APIs. FossilOrigin-Name: 35d1d63c7d60119b64341c561294890812837d5432d1d7bed3ed88d6212fbfa0
* Export sqlite3_result_subtype() and sqlite3_value_dup/free/subtype() to WASM.stephan2022-12-09
| | | FossilOrigin-Name: 4600a7bbdc4cbe14591d48ea19fe5f7de3a0c10a14cdd97fd51e263a13163d10
* Refactor the sqlite3_value-to-JS conversion from an internal detail to ↵stephan2022-12-09
| | | | | sqlite3.capi.sqlite3_value_to_js() for use with routines like sqlite3_module::xFilter(). FossilOrigin-Name: f6dbf280f99809a80c99337e4c22a86dea7a35ae41ae9a69144c4502385a0a1f
* Remove some unused sqlite3_status() codes from the JS API. Add custom JS ↵stephan2022-12-09
| | | | | wrappers for sqlite3_create_collation/_v2() which accept JS functions (plus tests). Expand the argument options for sqlite3_wasm_db_error() to enable it to translate exception objects to C-level errors. FossilOrigin-Name: 073a2f1eb006230ae0995a5ea6c789407bcaa819ec15b5064c66d8973ed4671a
* Rename the oft-used, verbose sqlite3.wasm.get/setMemValue() and ↵stephan2022-12-09
| | | | | get/setPtrValue() to peek/poke() and peek/pokePtr(). The old names are retained as aliases just in case any client code actually uses them, but they are now deprecated. FossilOrigin-Name: ad0a8139b0b025f8e9d2eca0c303557ef10fdfab8c8b65afb08c510a804073d5
* Export sqlite3_status() and sqlite3_stmt_status() to wasm. Expand the ↵stephan2022-12-09
| | | | | arg/return semantics of wasm.get/setPtrValue() and get/setMemValue() to simplify handling of multiple pointers. FossilOrigin-Name: e144fd5c88fa4151429a2fef3daf389588402e158267f0afa0dfd142527d76b9