1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-12-20 01:22:32 +03:00

JS code reformatting and doc updates. No functional changes.

FossilOrigin-Name: c566c653e4f55afa0660e819ed5b1fd96cb9b24bc78c333adcd8825331a9dd26
This commit is contained in:
stephan
2025-11-13 15:33:44 +00:00
parent a9025a5f1a
commit 319870836c
3 changed files with 59 additions and 62 deletions

View File

@@ -1960,55 +1960,58 @@ globalThis.sqlite3ApiBootstrap = async function sqlite3ApiBootstrap(
return (0===v) ? undefined : capi.sqlite3_value_to_js(v, throwIfCannotConvert); return (0===v) ? undefined : capi.sqlite3_value_to_js(v, throwIfCannotConvert);
}; };
/** if( true ){ /* changeset/preupdate additions... */
Internal impl of sqlite3_preupdate_new/old_js() and /**
sqlite3changeset_new/old_js(). Internal impl of sqlite3_preupdate_new/old_js() and
*/ sqlite3changeset_new/old_js().
const __newOldValue = function(pObj, iCol, impl){ */
impl = capi[impl]; const __newOldValue = function(pObj, iCol, impl){
if(!this.ptr) this.ptr = wasm.allocPtr(); impl = capi[impl];
else wasm.pokePtr(this.ptr, 0); if(!this.ptr) this.ptr = wasm.allocPtr();
const rc = impl(pObj, iCol, this.ptr); else wasm.pokePtr(this.ptr, 0);
if(rc) return SQLite3Error.toss(rc,arguments[2]+"() failed with code "+rc); const rc = impl(pObj, iCol, this.ptr);
const pv = wasm.peekPtr(this.ptr); if(rc) return SQLite3Error.toss(rc,arguments[2]+"() failed with code "+rc);
return pv ? capi.sqlite3_value_to_js( pv, true ) : undefined; const pv = wasm.peekPtr(this.ptr);
}.bind(Object.create(null)); return pv ? capi.sqlite3_value_to_js( pv, true ) : undefined;
}.bind(Object.create(null));
/** /**
A wrapper around sqlite3_preupdate_new() which fetches the A wrapper around sqlite3_preupdate_new() which fetches the
sqlite3_value at the given index and returns the result of sqlite3_value at the given index and returns the result of
passing it to sqlite3_value_to_js(). Throws on error. passing it to sqlite3_value_to_js(). Throws on error.
*/ */
capi.sqlite3_preupdate_new_js = capi.sqlite3_preupdate_new_js =
(pDb, iCol)=>__newOldValue(pDb, iCol, 'sqlite3_preupdate_new'); (pDb, iCol)=>__newOldValue(pDb, iCol, 'sqlite3_preupdate_new');
/** /**
The sqlite3_preupdate_old() counterpart of The sqlite3_preupdate_old() counterpart of
sqlite3_preupdate_new_js(), with an identical interface. sqlite3_preupdate_new_js(), with an identical interface.
*/ */
capi.sqlite3_preupdate_old_js = capi.sqlite3_preupdate_old_js =
(pDb, iCol)=>__newOldValue(pDb, iCol, 'sqlite3_preupdate_old'); (pDb, iCol)=>__newOldValue(pDb, iCol, 'sqlite3_preupdate_old');
/** /**
A wrapper around sqlite3changeset_new() which fetches the A wrapper around sqlite3changeset_new() which fetches the
sqlite3_value at the given index and returns the result of sqlite3_value at the given index and returns the result of
passing it to sqlite3_value_to_js(). Throws on error. passing it to sqlite3_value_to_js(). Throws on error.
If sqlite3changeset_new() succeeds but has no value to report, If sqlite3changeset_new() succeeds but has no value to report,
this function returns the undefined value, noting that undefined this function returns the undefined value, noting that
is a valid conversion from an `sqlite3_value`, so is unambiguous. undefined is not a valid conversion from an `sqlite3_value`, so
*/ is unambiguous.
capi.sqlite3changeset_new_js = */
(pChangesetIter, iCol) => __newOldValue(pChangesetIter, iCol, capi.sqlite3changeset_new_js =
'sqlite3changeset_new'); (pChangesetIter, iCol) => __newOldValue(pChangesetIter, iCol,
'sqlite3changeset_new');
/** /**
The sqlite3changeset_old() counterpart of The sqlite3changeset_old() counterpart of
sqlite3changeset_new_js(), with an identical interface. sqlite3changeset_new_js(), with an identical interface.
*/ */
capi.sqlite3changeset_old_js = capi.sqlite3changeset_old_js =
(pChangesetIter, iCol)=>__newOldValue(pChangesetIter, iCol, (pChangesetIter, iCol)=>__newOldValue(pChangesetIter, iCol,
'sqlite3changeset_old'); 'sqlite3changeset_old');
}/*changeset/preupdate additions*/
/* The remainder of the API will be set up in later steps. */ /* The remainder of the API will be set up in later steps. */
const sqlite3 = { const sqlite3 = {
@@ -2020,10 +2023,10 @@ globalThis.sqlite3ApiBootstrap = async function sqlite3ApiBootstrap(
config, config,
/** /**
Holds the version info of the sqlite3 source tree from which Holds the version info of the sqlite3 source tree from which
the generated sqlite3-api.js gets built. Note that its version the generated sqlite3-api.js gets built. Its version may well
may well differ from that reported by sqlite3_libversion(), but differ from that reported by sqlite3_libversion(), but that
that should be considered a source file mismatch, as the JS and should be considered a source file mismatch, as the JS and WASM
WASM files are intended to be built and distributed together. files are intended to be built and distributed together.
This object is initially a placeholder which gets replaced by a This object is initially a placeholder which gets replaced by a
build-generated object. build-generated object.
@@ -2048,9 +2051,7 @@ globalThis.sqlite3ApiBootstrap = async function sqlite3ApiBootstrap(
async init will be fatal to the init as a whole, but init async init will be fatal to the init as a whole, but init
routines are themselves welcome to install dummy catch() routines are themselves welcome to install dummy catch()
handlers which are not fatal if their failure should be handlers which are not fatal if their failure should be
considered non-fatal. If called more than once, the second and considered non-fatal.
subsequent calls are no-ops which return a pre-resolved
Promise.
Ideally this function is called as part of the Promise chain Ideally this function is called as part of the Promise chain
which handles the loading and bootstrapping of the API. If not which handles the loading and bootstrapping of the API. If not
@@ -2075,10 +2076,6 @@ globalThis.sqlite3ApiBootstrap = async function sqlite3ApiBootstrap(
some initializers. Retain them when running in test mode some initializers. Retain them when running in test mode
so that we can add tests for them. */ so that we can add tests for them. */
delete sqlite3.util; delete sqlite3.util;
/* It's conceivable that we might want to expose
StructBinder to client-side code, but it's only useful if
clients build their own sqlite3.wasm which contains their
own C struct types. */
delete sqlite3.StructBinder; delete sqlite3.StructBinder;
} }
return sqlite3; return sqlite3;

View File

@@ -1,5 +1,5 @@
C Add\sthe\s#include\s-raw\sflag\sto\sext/wasm/c-pp-lite.c\sto\ssupport\sa\spending\sfeature. C JS\scode\sreformatting\sand\sdoc\supdates.\sNo\sfunctional\schanges.
D 2025-11-13T14:47:41.941 D 2025-11-13T15:33:44.801
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -593,7 +593,7 @@ F ext/wasm/api/pre-js.c-pp.js b1a7a09d14df1f36de11e801ba06cb92c0ddeb520e5b2f2883
F ext/wasm/api/sqlite3-api-cleanup.js 79b54a566291e17c0c3e165c6c4969c48ec17cd297755180151af65ac616dfa0 F ext/wasm/api/sqlite3-api-cleanup.js 79b54a566291e17c0c3e165c6c4969c48ec17cd297755180151af65ac616dfa0
F ext/wasm/api/sqlite3-api-glue.c-pp.js 79a54b54ca6324d28e31e19b56bbaebb7d2cc4b3079066e7e901333fa5047c53 F ext/wasm/api/sqlite3-api-glue.c-pp.js 79a54b54ca6324d28e31e19b56bbaebb7d2cc4b3079066e7e901333fa5047c53
F ext/wasm/api/sqlite3-api-oo1.c-pp.js 31dbfd470c91ffd96d77399b749bab6b69e3ba9074188833f97ac13f087cf07b F ext/wasm/api/sqlite3-api-oo1.c-pp.js 31dbfd470c91ffd96d77399b749bab6b69e3ba9074188833f97ac13f087cf07b
F ext/wasm/api/sqlite3-api-prologue.js b6b2fd1720c484e168705909862442b4524a1e61e16b4549a5725dd28c3cecc2 F ext/wasm/api/sqlite3-api-prologue.js 68cf99ffc9742462323da3f3b207027472214727a750a952c6c10d53b11a3fa6
F ext/wasm/api/sqlite3-api-worker1.c-pp.js 1041dd645e8e821c082b628cd8d9acf70c667430f9d45167569633ffc7567938 F ext/wasm/api/sqlite3-api-worker1.c-pp.js 1041dd645e8e821c082b628cd8d9acf70c667430f9d45167569633ffc7567938
F ext/wasm/api/sqlite3-license-version-header.js 0c807a421f0187e778dc1078f10d2994b915123c1223fe752b60afdcd1263f89 F ext/wasm/api/sqlite3-license-version-header.js 0c807a421f0187e778dc1078f10d2994b915123c1223fe752b60afdcd1263f89
F ext/wasm/api/sqlite3-opfs-async-proxy.js 9654b565b346dc609b75d15337f20acfa7af7d9d558da1afeb9b6d8eaa404966 F ext/wasm/api/sqlite3-opfs-async-proxy.js 9654b565b346dc609b75d15337f20acfa7af7d9d558da1afeb9b6d8eaa404966
@@ -2167,8 +2167,8 @@ F tool/version-info.c 33d0390ef484b3b1cb685d59362be891ea162123cea181cb8e6d2cf6dd
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh d924598cf2f55a4ecbc2aeb055c10bd5f48114793e7ba25f9585435da29e7e98 F tool/warnings.sh d924598cf2f55a4ecbc2aeb055c10bd5f48114793e7ba25f9585435da29e7e98
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P d1e901eddc25175174d0706238ae0c33bfa5569e0c2ba4f1164b7a9600203442 P 42c30c314969c0f2573bbe36615683ac19a7ba4e30004c7080873459096caaf5
R 69751ab1669928a56efde739054714dc R d768b02f322c1c83673e8befacc63f8f
U stephan U stephan
Z 96038a39e433e91de1388406d7509460 Z 4b4e0581197e43009bfda31bfa74f55c
# Remove this line to create a well-formed Fossil manifest. # Remove this line to create a well-formed Fossil manifest.

View File

@@ -1 +1 @@
42c30c314969c0f2573bbe36615683ac19a7ba4e30004c7080873459096caaf5 c566c653e4f55afa0660e819ed5b1fd96cb9b24bc78c333adcd8825331a9dd26