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

Further docs and minor cleanups in the JS virtual table helper.

FossilOrigin-Name: c31e7488ac1a6b957782b72bd026b1f0590637b631e44a1fdf1dedeb5c587819
This commit is contained in:
stephan
2022-12-08 18:18:37 +00:00
parent 500fa7d518
commit 1a9a29815a
3 changed files with 23 additions and 17 deletions

View File

@ -327,13 +327,19 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
};
/**
Internal helper for implementing xVtab and xCursor.
The first argument must be the logical name of the
handler ('xVtab' or 'xCursor') and the second must be
the capi.XYZ struct-type value, e.g. capi.sqlite3_vtab
or capi.sqlite3_vtab_cursor.
A factory function which implements a simple lifetime manager for
mappings between C struct pointers and their JS-level wrappers.
The first argument must be the logical name of the manager
(e.g. 'xVtab' or 'xCursor'), which is only used for error
reporting. The second must be the capi.XYZ struct-type value,
e.g. capi.sqlite3_vtab or capi.sqlite3_vtab_cursor.
Returns an object with 4 methods: create(), get(), unget(), and
dispose(), plus a StructType member with the value of the 2nd
argument. The methods are documented in the body of this
function.
*/
const __xLifetimeManager = function(name, StructType){
const StructPtrMapper = function(name, StructType){
const __xWrap = __xWrapFactory(name,StructType);
/**
This object houses a small API for managing mappings of (`T*`)
@ -406,18 +412,18 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
instances in sqlite3_module methods to capi.sqlite3_vtab
objects.
The API docs are in the API-internal __xLifetimeManager().
The API docs are in the API-internal StructPtrMapper().
*/
vt.xVtab = __xLifetimeManager('xVtab', capi.sqlite3_vtab);
vt.xVtab = StructPtrMapper('xVtab', capi.sqlite3_vtab);
/**
A lifetime-management object for mapping `sqlite3_vtab_cursor*`
instances in sqlite3_module methods to capi.sqlite3_vtab_cursor
objects.
The API docs are in the API-internal __xLifetimeManager().
The API docs are in the API-internal StructPtrMapper().
*/
vt.xCursor = __xLifetimeManager('xCursor', capi.sqlite3_vtab_cursor);
vt.xCursor = StructPtrMapper('xCursor', capi.sqlite3_vtab_cursor);
/**
Convenience form of creating an sqlite3_index_info wrapper,

View File

@ -1,5 +1,5 @@
C Ease-of-use/legibility\simprovements\sin\sthe\svirtual\stable\sJS\shelpers.
D 2022-12-08T17:07:27.475
C Further\sdocs\sand\sminor\scleanups\sin\sthe\sJS\svirtual\stable\shelper.
D 2022-12-08T18:18:37.994
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -509,7 +509,7 @@ F ext/wasm/api/sqlite3-api-prologue.js 1380e933325c11786b2afc93fc8ff88c2fd1ffeac
F ext/wasm/api/sqlite3-api-worker1.js e94ba98e44afccfa482874cd9acb325883ade50ed1f9f9526beb9de1711f182f
F ext/wasm/api/sqlite3-license-version-header.js a661182fc93fc2cf212dfd0b987f8e138a3ac98f850b1112e29b5fbdaecc87c3
F ext/wasm/api/sqlite3-opfs-async-proxy.js 7795b84b66a7a8dedc791340709b310bb497c3c72a80bef364fa2a58e2ddae3f
F ext/wasm/api/sqlite3-v-helper.js d0d647110f8595d26836951cfc5a47f15282f20e72584decc0b00e2a3f0d169c
F ext/wasm/api/sqlite3-v-helper.js 3f0ef738f5c44943f05ec5bd86976d617e8ae229a0127a1efe81bbb4763293a7
F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 8ec510fee735c646fb18a3b99f0ca5ca461f9e066c43cdc404d7144f12ae6ed6
F ext/wasm/api/sqlite3-wasi.h 25356084cfe0d40458a902afb465df8c21fc4152c1d0a59b563a3fba59a068f9
F ext/wasm/api/sqlite3-wasm.c 97034ab4f40ec1fac71ccfaf3afffdca6b1ea2dcd95b7871527bad0f34e152b0
@ -2067,8 +2067,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P a1454744c770a30a32a6d7b7fc59ef7be48cf67348b238540592850d7c2c7757
R 17cb094a6db22f136920052decf90bf5
P 54c7ad7e08bdb87579398ade366605bfa2e2538a94aabcc6e4cda8e173649760
R 4c50a667470c9bbb57a953933f0b79e2
U stephan
Z fce05bcff7bc40d31cdbdf756e15ecfc
Z df7927342245d4323b165b2786a2dc10
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
54c7ad7e08bdb87579398ade366605bfa2e2538a94aabcc6e4cda8e173649760
c31e7488ac1a6b957782b72bd026b1f0590637b631e44a1fdf1dedeb5c587819