Skip to content

[Chore] Update fork #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 297 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
297 commits
Select commit Hold shift + click to select a range
c1fb01d
Code polishing.
shoestringr Jan 11, 2024
9f9b001
Handle int64_t arguments in TestVFS.
shoestringr Jan 11, 2024
b5c65d6
Change relay names to include added key argument(s).
shoestringr Jan 12, 2024
30bf4b8
Use macro to simplify relay declaration.
shoestringr Jan 12, 2024
0d831af
Improve async method handling.
shoestringr Jan 12, 2024
6e8f9b4
Rework VFS.Base and create FacadeVFS.
shoestringr Jan 12, 2024
2421a75
Pass sqlite3_free address to JavaScript.
shoestringr Jan 12, 2024
b1f2efc
Improve legalization handling.
shoestringr Jan 12, 2024
eefca58
Allow API use.
shoestringr Jan 12, 2024
98e65e6
Add MemoryAsyncVFS.
shoestringr Jan 12, 2024
2d79f3e
Rename locking argument.
shoestringr Jan 12, 2024
c121705
Remove libadapters.c debugging printf.
shoestringr Jan 12, 2024
299b5da
Code polishing.
shoestringr Jan 12, 2024
d39f338
Rename arguments.
shoestringr Jan 12, 2024
f2a8cf8
Parse URI search params in FacadeVFS.
shoestringr Jan 13, 2024
169b3d8
Create OriginPrivateVFS.
shoestringr Jan 13, 2024
9e5f9e5
Rewrote main demo.
shoestringr Jan 13, 2024
12f10b6
Add exclusive locking mixin.
shoestringr Jan 14, 2024
0cd6369
Add WebLocksShared mixin.
shoestringr Jan 14, 2024
f8d21e0
Use "build" param in demo-worker.js.
shoestringr Jan 14, 2024
a350256
Report config in demo.
shoestringr Jan 14, 2024
8578eda
Add isAsync argument to adapters_support().
shoestringr Jan 14, 2024
c244de9
Reimplement benchmarks page.
shoestringr Jan 14, 2024
da5e1d4
Check in builds.
shoestringr Jan 14, 2024
8d35055
Use build=asyncify in demos.
shoestringr Jan 14, 2024
5b653c7
Add static create() to VFS classes.
shoestringr Jan 14, 2024
38a48da
Add WebLocksSingleContextMixin.
shoestringr Jan 14, 2024
869bc1d
Remove obsolete source files.
shoestringr Jan 14, 2024
600ceb5
Install @web/test-runner.
shoestringr Jan 17, 2024
2bc9688
Updates for VSCode checks.
shoestringr Jan 17, 2024
5df57f2
Update typedoc.
shoestringr Jan 19, 2024
b555780
Create test framework.
shoestringr Jan 19, 2024
453e7ce
Implement API tests.
shoestringr Jan 20, 2024
55e153c
Create TestContext class.
shoestringr Jan 20, 2024
e468e26
Add better JSPI detection.
shoestringr Jan 20, 2024
0593169
Merge branch 'dev-retire-karma' into dev
shoestringr Jan 20, 2024
69f7f84
Update ci.yml
rhashimoto Jan 20, 2024
b5bc859
Update ci.yml.
shoestringr Jan 20, 2024
7e979a8
Add low-level prepare test.
shoestringr Jan 20, 2024
b20c90c
Enable JSPI in the test browser launcher.
shoestringr Jan 20, 2024
226f404
Update WASM builds with EMSDK 3.1.47.
shoestringr Jan 21, 2024
e81c533
Add tests for miscellaneous functions.
shoestringr Jan 21, 2024
0cb7a2d
Handle NoModificationAllowedError in test-worker.
shoestringr Jan 21, 2024
1bf2d40
Add SQL tests.
shoestringr Jan 21, 2024
f70d410
Add exclusive lock to test-worker.
shoestringr Jan 21, 2024
3dc3270
Use test-runner concurrency instead of lock.
shoestringr Jan 21, 2024
6ddd790
Clear IndexedDB for tests.
shoestringr Jan 21, 2024
a320dee
Create VFS tests.
shoestringr Jan 21, 2024
e2a160b
Add OriginPrivateVFS tests.
shoestringr Jan 21, 2024
520787a
Implement IDBBatchAtomicVFS.
shoestringr Jan 21, 2024
6aa8f36
Export more source files.
shoestringr Jan 30, 2024
e093402
Add obfuscated FLOOR VFS.
shoestringr Jan 30, 2024
c8a0fde
Multiple connection fallback for OriginPrivateVFS.
shoestringr Jan 30, 2024
e58654f
Add VFS comparison chart.
shoestringr Jan 31, 2024
4854da5
Bump CI Chrome version to 121.
shoestringr Jan 31, 2024
1cd7c45
Reset demo-worker in first instance only.
shoestringr Jan 31, 2024
ca82e28
Update FLOOR.
shoestringr Jan 31, 2024
d6e19ce
Restrict OriginPrivateVFS journal mode.
shoestringr Jan 31, 2024
ab37145
Cleanup.
shoestringr Jan 31, 2024
3a4fcf2
Update FLOOR.
shoestringr Jan 31, 2024
4eca6c9
Update README.md
rhashimoto Jan 31, 2024
895aee7
Create basic AccessHandlePoolVFS.
shoestringr Jan 31, 2024
ae411b5
Add AccessHandlePoolVFS tests.
shoestringr Jan 31, 2024
81a0dc6
Update README.md
rhashimoto Jan 31, 2024
a1d0401
Truncate "deleted" AccessHandlePoolVFS files.
shoestringr Feb 2, 2024
97f9a5f
Work around Chrome directory name bug.
shoestringr Feb 2, 2024
d7e5568
Improve demo-worker.js searchParams configurability.
shoestringr Feb 2, 2024
bacb22f
Add AccessHandlePoolVFS.createPersistentDatabaseFile().
shoestringr Feb 3, 2024
0b6e9b8
Remove open flags from IndexedDB metadata.
shoestringr Feb 3, 2024
abc672b
Upgrade old IDBBatchAtomicVFS databases.
shoestringr Feb 3, 2024
1d3ffbc
AccessHandlePoolVFS doesn't need to pre-create a -floor file.
shoestringr Feb 3, 2024
0201e02
Update FLOOR.
shoestringr Feb 3, 2024
ea22a3f
Implement create_function().
shoestringr Feb 4, 2024
4366731
Update doc.
shoestringr Feb 4, 2024
587a5af
Refactor callbacks to separate .c/.js files.
shoestringr Feb 4, 2024
4eaa8b2
Add progress handler.
shoestringr Feb 4, 2024
9a63f61
Wrap libvfs.js and libfunction.js in IIFE.
shoestringr Feb 4, 2024
1935205
Add libauthorizer.{c,js}.
shoestringr Feb 4, 2024
649ac77
Minor cleanup.
shoestringr Feb 4, 2024
d5c471a
Guarantee freeing open_v2() filename.
shoestringr Feb 7, 2024
2d6ab41
Rewrite statements() convenience function.
shoestringr Feb 7, 2024
c0e4550
Remove str and prepare_v2 functions.
shoestringr Feb 7, 2024
22eb7d4
Add options argument to statements().
shoestringr Feb 7, 2024
3697ae3
Fix statements() for WebAssembly memory growth.
shoestringr Feb 7, 2024
dbe7f14
Change statements() encoding back to UTF-8.
shoestringr Feb 7, 2024
c20cf28
Reimplement createUTF8() with TextEncoder.
shoestringr Feb 7, 2024
7efcc9b
Add contention demo.
shoestringr Feb 10, 2024
a757d82
Remove obsolete demos.
shoestringr Feb 10, 2024
507eda5
Update file demo.
shoestringr Feb 10, 2024
a4dc38b
Minor type fix.
shoestringr Feb 10, 2024
8e4eabc
Tweak contention demo.
shoestringr Feb 10, 2024
6e9a0e0
Switch IDBBatchAtomicVFS to WebLocksShared.
shoestringr Feb 11, 2024
09d7dbb
Reimplement AccessHandlePoolVFS with retry ops.
shoestringr Feb 16, 2024
b6fa913
Remove task release from contention worker.
shoestringr Feb 17, 2024
6423caf
Tweaks for AccessHandlePoolVFS.
shoestringr Feb 17, 2024
69c95bc
Fix OriginPrivateVFS race.
shoestringr Feb 17, 2024
dd42596
Restore WebLocksShared on OriginPrivateVFS.
shoestringr Feb 18, 2024
b5ee4ec
Improve UnsafeHandlePoolVFS logging.
shoestringr Feb 18, 2024
16bae9f
Remove AccessHandlePoolVFS unnecessary state.
shoestringr Feb 18, 2024
783c99e
Update IDBBatchAtomicVFS logging.
shoestringr Feb 18, 2024
a4e614e
Update README.md
rhashimoto Feb 18, 2024
68cfe9f
Checkpoint for PermutedVFS.
shoestringr Feb 20, 2024
e32c145
Reclaim unused offsets.
shoestringr Feb 21, 2024
d38e2b2
Add PermutedVFS to contention demo.
shoestringr Feb 21, 2024
e93764b
Refactor pending and reclaiming processing.
shoestringr Feb 21, 2024
c9cd240
Fix contention demo race condition bugs.
shoestringr Feb 21, 2024
7a78f5b
Update FLOOR.
shoestringr Feb 29, 2024
1be3b46
Add flush to PermutedVFS.
shoestringr Feb 29, 2024
a4c3651
Abandon PermutedVFS for now.
shoestringr Apr 2, 2024
f85ba74
Attempt to fix GitHub Actions.
shoestringr Apr 2, 2024
17ec15f
Rename to OPFSCoopSyncVFS.
shoestringr May 1, 2024
d91d5eb
Port the original AccessHandlePoolVFS.
shoestringr May 2, 2024
071e865
Add AccessHandlePoolVFS tests.
shoestringr May 2, 2024
f91cd7b
Update dependencies per dependabot.
shoestringr May 2, 2024
70931a9
Merge pull request #170 from rhashimoto/dependabot
rhashimoto May 2, 2024
0549208
Merge branch 'master' into dev
shoestringr May 2, 2024
92f2694
Update README.md
rhashimoto May 2, 2024
d68f66f
Change GitHub Actions CI to node 20.
shoestringr May 2, 2024
9d5e3a2
Rework TestContext usage.
shoestringr May 3, 2024
98e8269
Add crash recovery test.
shoestringr May 3, 2024
d3ebdf4
Remove module (vtable) API.
shoestringr May 3, 2024
fcd8bec
Remove unused debugging code.
shoestringr May 3, 2024
66f2f0f
Add unscoped statement test.
shoestringr May 3, 2024
7af7dc4
Add create_function() tests.
shoestringr May 3, 2024
27f6779
Add MemoryAsyncVFS test.
shoestringr May 4, 2024
6321d75
Test VFS short read.
shoestringr May 4, 2024
013eb6f
Improve delete on close test.
shoestringr May 4, 2024
7014ec7
Add contention test.
shoestringr May 4, 2024
f5b5ca4
Update README.md
rhashimoto May 4, 2024
f65fb1b
Remove UnsafeHandlePoolVFS.
shoestringr May 4, 2024
8f8ce16
Remove AHP contention demo.
shoestringr May 4, 2024
8957f5a
Fix hello demo.
shoestringr May 4, 2024
ab910f4
Update README.md
rhashimoto May 4, 2024
e22a6ee
Update README.md
rhashimoto May 5, 2024
a3930bf
Restrict journal_mode accepted settings.
shoestringr May 5, 2024
942f89f
Rename OriginPrivateVFS to OPFSAdaptiveVFS.
shoestringr May 5, 2024
c75a4b3
Fix create_function asynchronous test.
shoestringr May 5, 2024
ccba448
Test callbacks on Asyncify and JSPI builds.
shoestringr May 5, 2024
8f13d97
Add progress handler test.
shoestringr May 5, 2024
9dfdda2
Fix set_authorizer() with async function.
shoestringr May 5, 2024
bac53b4
Removed unused directory reference.
shoestringr May 5, 2024
956462b
Fix libprogress_progress_handler return type.
shoestringr May 5, 2024
6b45afc
Update minimum EMSDK version.
shoestringr May 5, 2024
95c6d7c
Rework WebLocksMixin.
shoestringr May 10, 2024
760cd55
Rename method FacadeVFS.getFilename().
shoestringr May 10, 2024
ef70abd
Add option for IDBBatchAtomicVFS IndexedDB name.
shoestringr May 10, 2024
c6b8bd2
Add WebLocksMixin tests.
shoestringr May 10, 2024
ff4c9e1
Update web-test-runner-jasmine.
shoestringr May 10, 2024
d1ef697
Prepare for write transaction hints.
shoestringr May 10, 2024
c352775
Implement "shared+hint" locking with PRAGMA write_hint.
shoestringr May 11, 2024
9341282
Fix IDBBatchAtomicVFS synchronization bug.
shoestringr May 12, 2024
e669da9
Checkpoint for write_hint demo.
shoestringr May 12, 2024
55748b8
Create OPFSPermutedVFS.
shoestringr May 18, 2024
be729ff
Implement OPFSPermutedVFS VACUUM.
shoestringr May 18, 2024
7abd2f2
Fix OPFSPermutedVFS off-by-1 bug.
shoestringr May 19, 2024
5a29f03
Add OPFSPermutedVFS checksums.
shoestringr May 19, 2024
f6c84a1
Add OPFSPermutedVFS flush PRAGMAs.
shoestringr May 19, 2024
6303fd4
Fix OPFSPermutedVFS pageSize initialization.
shoestringr May 19, 2024
c7c2600
Add OPFSPermutedVFS tests.
shoestringr May 19, 2024
ad0c0ba
Fix example imports for demos.
shoestringr May 19, 2024
3ef2756
Add OPFSPermutedVFS to API tests.
shoestringr May 19, 2024
3f6a633
Fix OPFSPermutedVFS zero pageSize bug.
shoestringr May 19, 2024
29ec532
Fix OPFSPermutedVFS VACUUM file truncation.
shoestringr May 19, 2024
69549ee
Fix OPFSPermutedVFS consistency checks.
shoestringr May 19, 2024
4a42d8c
Optimize OPFSPermutedVFS IDB transactions.
shoestringr May 20, 2024
09820b8
Fix OPFSPermutedVFS free list initialization.
shoestringr May 21, 2024
031a00e
Improve OPFSPermutedVFS.#prepareOverwrite() performance.
shoestringr May 21, 2024
4b47b2e
Remove FLOOR.
shoestringr May 21, 2024
b9da74f
Update README.md
rhashimoto May 21, 2024
5420dd2
Add WebLocksMixin shared+hint tests.
shoestringr May 22, 2024
23acef9
Use write hint in OPFSPermutedVFS.
shoestringr May 23, 2024
518be94
Limit OPFSPermutedVFS calls to getSize().
shoestringr May 23, 2024
a287839
Add OPFSPermutedVFS synchronous setting.
shoestringr May 24, 2024
b4dcd3e
Code polishing.
shoestringr May 25, 2024
8224660
Bump package version.
shoestringr May 25, 2024
eb6e625
Merge pull request #174 from rhashimoto/merge-dev
rhashimoto May 26, 2024
12d5c0d
Improve hello demo.
shoestringr May 26, 2024
0968478
Update README.md
rhashimoto May 26, 2024
5666020
Merge pull request #175 from rhashimoto/hello-demo
rhashimoto May 26, 2024
477c331
Update README.md
rhashimoto May 26, 2024
8b4be5e
Update dependencies per dependabot.
shoestringr May 26, 2024
4dc6a19
Merge pull request #176 from rhashimoto/dependabot
rhashimoto May 26, 2024
bf27888
Update README.md
rhashimoto May 27, 2024
0845f27
Move hello demo to its own directory.
shoestringr May 27, 2024
c02a70d
Update README.md
rhashimoto May 27, 2024
bcf51ad
Merge pull request #177 from rhashimoto/move-hello
rhashimoto May 28, 2024
65e27b0
Update README.md
rhashimoto May 28, 2024
f7a1cc4
Merge pull request #178 from rhashimoto/move-hello
rhashimoto May 28, 2024
2511b98
Fix hello for GitHub Pages.
shoestringr May 28, 2024
1af11e6
Merge pull request #179 from rhashimoto/fix-hello
rhashimoto May 28, 2024
ac2a9b5
Output HTML tables in hello demo.
shoestringr May 28, 2024
7975871
Merge pull request #180 from rhashimoto/hello-tables
rhashimoto May 28, 2024
eee23f5
remove sql_0001
AlexErrant May 29, 2024
a6d71b9
Merge pull request #181 from AlexErrant/remove-sql_0001
rhashimoto May 29, 2024
de2fa2b
Update README.md
rhashimoto May 29, 2024
a16ed34
Add IDBBatchAtomicVFS version upgrade test.
shoestringr Jun 1, 2024
73cc8ac
Remove obsolete tests.
shoestringr Jun 1, 2024
3ddeca1
Remove unused package dependency.
shoestringr Jun 2, 2024
7aabd2f
Improve IDBBatchAtomicVFS update test data.
shoestringr Jun 2, 2024
90047fd
Update README.md
rhashimoto Jun 3, 2024
456ca21
Remove obsolete karma configuration file.
shoestringr Jun 3, 2024
0842353
Update README.md
rhashimoto Jun 5, 2024
f5a2f44
Update README.md
rhashimoto Jun 5, 2024
304dba3
Fix WebLocksMixin.jCheckReservedLock bug.
shoestringr Jun 8, 2024
a05f863
Merge pull request #182 from rhashimoto/WebLocksMixin-bug
rhashimoto Jun 8, 2024
c3a81a1
Add OPFSAnyContextVFS.
shoestringr Jun 11, 2024
d248b79
Update README.md
rhashimoto Jun 11, 2024
2f7b024
Add OPFSAnyContextVFS to hello demo.
shoestringr Jun 11, 2024
8d7eda9
Merge pull request #183 from rhashimoto/OPFSAnyContextVFS
rhashimoto Jun 11, 2024
0df7366
Update README.md
rhashimoto Jun 13, 2024
7c6a438
Add JSPI feature detection credit comment.
shoestringr Jun 16, 2024
44cc640
Upgrade SQLite to 3.46.0.
shoestringr Jun 16, 2024
5c36915
Merge pull request #185 from rhashimoto/sqlite-3.46.0
rhashimoto Jun 16, 2024
c451743
Update package version.
shoestringr Jun 16, 2024
2f0163f
Create IDBMirrorVFS.
shoestringr Jun 18, 2024
ddd82eb
Merge pull request #188 from rhashimoto/IDBMirrorVFS
rhashimoto Jun 29, 2024
3ccf9d8
Avoid IndexedDB name conflict in demo.
shoestringr Jun 29, 2024
1508eae
Updates per dependabot.
shoestringr Jun 29, 2024
82b7dc0
Merge pull request #190 from rhashimoto/dependabot
rhashimoto Jun 29, 2024
ec56366
More dependabot updates.
shoestringr Jun 29, 2024
230c4c5
Merge pull request #191 from rhashimoto/dependabot
rhashimoto Jun 29, 2024
6b411ef
Update README.md
rhashimoto Jun 29, 2024
7a99adc
Update README.md
rhashimoto Jun 29, 2024
61b4298
Fix #192. Incorrect package.json.
shoestringr Jun 30, 2024
8193d40
Merge pull request #193 from rhashimoto/package
rhashimoto Jun 30, 2024
6e74c76
Set package version to 1.0.0.
shoestringr Jul 5, 2024
55bf0b6
Merge pull request #194 from rhashimoto/release-1.0.0
rhashimoto Jul 6, 2024
100eea7
Update README.md
rhashimoto Jul 18, 2024
e635e31
Add IDBMirrorVFS to hello demo.
shoestringr Jul 23, 2024
f1ab3d5
Merge pull request #195 from rhashimoto/update-hello-demo
rhashimoto Jul 23, 2024
bfd23c5
Defer IDBMirrorVFS and OPFSPermutedVFS broadcasts.
shoestringr Jul 26, 2024
7722688
Merge pull request #197 from rhashimoto/sync-broadcast
rhashimoto Jul 26, 2024
3d5aa74
Update README.md
rhashimoto Jul 26, 2024
001852b
Fix #187. Add clear_bindings().
shoestringr Jul 26, 2024
5fef539
Merge pull request #198 from rhashimoto/clear-bindings
rhashimoto Jul 26, 2024
fc5c264
Update package.json
rhashimoto Jul 28, 2024
f5092b5
Merge pull request #199 from rhashimoto/increment-version
rhashimoto Jul 29, 2024
b1cf757
Bump @75lb/deep-merge from 1.1.1 to 1.1.2
dependabot[bot] Aug 15, 2024
160e2fb
Merge pull request #203 from rhashimoto/dependabot/npm_and_yarn/75lb/…
rhashimoto Aug 15, 2024
2578a2f
chore: update from upstream
stevensJourney Sep 5, 2024
0af8134
chore: re-add table changes
stevensJourney Sep 5, 2024
351ba93
wip
stevensJourney Sep 5, 2024
de00ff0
wip
stevensJourney Sep 5, 2024
f0d4148
update makefile
stevensJourney Sep 5, 2024
55ee81d
update types
stevensJourney Sep 5, 2024
8573556
update core version
stevensJourney Sep 5, 2024
187d9cd
added changeset
stevensJourney Sep 5, 2024
df52bc1
better building on macos
stevensJourney Sep 5, 2024
24ec2c9
use node 20
stevensJourney Sep 5, 2024
2997cf2
restore last insert id method
stevensJourney Sep 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove str and prepare_v2 functions.
  • Loading branch information
shoestringr committed Feb 7, 2024
commit c0e4550328f2960ee609479102c859110594026d
2 changes: 1 addition & 1 deletion docs/assets/search.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 3 additions & 35 deletions docs/interfaces/SQLiteAPI.html

Large diffs are not rendered by default.

84 changes: 15 additions & 69 deletions src/sqlite-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -521,21 +521,21 @@ export function Factory(Module) {
};
})();

sqlite3.prepare_v2 = (function() {
const fname = 'sqlite3_prepare_v2';
const f = Module.cwrap(fname, ...decl('nnnnn:n'), { async });
return async function(db, sql) {
const result = await f(db, sql, -1, tmpPtr[0], tmpPtr[1]);
check(fname, result, db);

const stmt = Module.getValue(tmpPtr[0], '*');
if (stmt) {
mapStmtToDB.set(stmt, db);
return { stmt, sql: Module.getValue(tmpPtr[1], '*') };
}
return null;
};
})();
// sqlite3.prepare_v2 = (function() {
// const fname = 'sqlite3_prepare_v2';
// const f = Module.cwrap(fname, ...decl('nnnnn:n'), { async });
// return async function(db, sql) {
// const result = await f(db, sql, -1, tmpPtr[0], tmpPtr[1]);
// check(fname, result, db);

// const stmt = Module.getValue(tmpPtr[0], '*');
// if (stmt) {
// mapStmtToDB.set(stmt, db);
// return { stmt, sql: Module.getValue(tmpPtr[1], '*') };
// }
// return null;
// };
// })();

sqlite3.progress_handler = function(db, nProgressOps, handler, userData) {
verifyDatabase(db);
Expand Down Expand Up @@ -769,60 +769,6 @@ export function Factory(Module) {
};
})();

// Duplicate some of the SQLite dynamic string API but without
// calling SQLite (except for memory allocation). We need some way
// to transfer Javascript strings and might as well use an API
// that mimics the SQLite API.
let stringId = 0;
const strings = new Map();

sqlite3.str_new = function(db, s = '') {
const sBytes = Module.lengthBytesUTF8(s);
const str = stringId++ & 0xffffffff;
const data = {
offset: Module._sqlite3_malloc(sBytes + 1),
bytes: sBytes
};
strings.set(str, data);
Module.stringToUTF8(s, data.offset, data.bytes + 1);
return str;
};

sqlite3.str_appendall = function(str, s) {
if (!strings.has(str)) {
throw new SQLiteError('not a string', SQLite.SQLITE_MISUSE);
}
const data = strings.get(str);

const sBytes = Module.lengthBytesUTF8(s);
const newBytes = data.bytes + sBytes;
const newOffset = Module._sqlite3_malloc(newBytes + 1);
const newArray = Module.HEAPU8.subarray(newOffset, newOffset + newBytes + 1);
newArray.set(Module.HEAPU8.subarray(data.offset, data.offset + data.bytes));
Module.stringToUTF8(s, newOffset + data.bytes, sBytes + 1);

Module._sqlite3_free(data.offset);
data.offset = newOffset;
data.bytes = newBytes;
strings.set(str, data);
};

sqlite3.str_finish = function(str) {
if (!strings.has(str)) {
throw new SQLiteError('not a string', SQLite.SQLITE_MISUSE);
}
const data = strings.get(str);
strings.delete(str);
Module._sqlite3_free(data.offset);
};

sqlite3.str_value = function(str) {
if (!strings.has(str)) {
throw new SQLiteError('not a string', SQLite.SQLITE_MISUSE);
}
return strings.get(str).offset;
};

sqlite3.value = function(pValue) {
const type = sqlite3.value_type(pValue);
switch (type) {
Expand Down
97 changes: 0 additions & 97 deletions src/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -723,51 +723,6 @@ declare interface SQLiteAPI {
zVfs?: string
): Promise<number>;

/**
* Compile an SQL statement
*
* SQL is provided as a pointer in WASM memory, so the utility functions
* {@link str_new} and {@link str_value} should be used. The returned
* Promise-wrapped object provides both the prepared statement and a
* pointer to the still uncompiled SQL that can be used with the next
* call to this function. A Promise containing `null` is returned
* when no statement remains.
*
* Each prepared statement should be destroyed with {@link finalize}
* after its usage is complete.
*
* Code using {@link prepare_v2} generally looks like this:
* ```javascript
* const str = sqlite3.str_new(db, sql);
* try {
* // Traverse and prepare the SQL, statement by statement.
* let prepared = { stmt: null, sql: sqlite3.str_value(str) };
* while ((prepared = await sqlite3.prepare_v2(db, prepared.sql))) {
* try {
* // Step through the rows produced by the statement.
* while (await sqlite3.step(prepared.stmt) === SQLite.SQLITE_ROW) {
* // Do something with the row data...
* }
* } finally {
* sqlite3.finalize(prepared.stmt);
* }
* }
* } finally {
* sqlite3.str_finish(str);
* }
* ```
*
* The {@link statements} convenience function can be used to
* avoid the boilerplate of calling {@link prepare_v2} directly.
* @see https://www.sqlite.org/c3ref/prepare.html
* @param db database pointer
* @param sql SQL pointer
* @returns Promise-wrapped object containing the prepared statement
* pointer and next SQL pointer, or a Promise containing `null` when
* no statement remains
*/
prepare_v2(db: number, sql: number): Promise<{ stmt: number, sql: number}|null>;

/**
* Specify callback to be invoked between long-running queries
*
Expand Down Expand Up @@ -923,58 +878,6 @@ declare interface SQLiteAPI {
*/
step(stmt: number): Promise<number>;

/**
* Create a new `sqlite3_str` dynamic string instance
*
* The purpose for `sqlite3_str` is to transfer a SQL string in
* Javascript to WebAssembly memory for use with {@link prepare_v2}.
*
* An optional initialization argument has been added for convenience
* which is functionally equivalent to (but slightly more efficient):
* ```javascript
* const str = sqlite3.str_new(db);
* sqlite3.str_appendall(str, s);
* ```
*
* A `sqlite3_str` instance should always be destroyed with
* {@link str_finish} after use to avoid a resource leak.
*
* @see https://www.sqlite.org/c3ref/str_append.html
* @param db database pointer
* @param s optional initialization string
* @returns `sqlite3_str` pointer
*/
str_new(db: number, s?:string): number;

/**
* Add content to a `sqlite3_str` dynamic string
*
* Not recommended for building strings incrementally; prefer using
* Javascript and {@link str_new} with initialization.
* @see https://www.sqlite.org/c3ref/str_append.html
* @param str `sqlite3_str` pointer
* @param s string to append
*/
str_appendall(str: number, s: string): void;

/**
* Get pointer to `sqlite3_str` dynamic string data
*
* The returned pointer points to the UTF-8 encoded string in
* WebAssembly memory. Use as input with {@link prepare_v2}.
* @see https://www.sqlite.org/c3ref/str_errcode.html
* @param str `sqlite3_str` pointer
* @returns pointer to string data
*/
str_value(str: number): number;

/**
* Finalize a `sqlite3_str` dynamic string created with {@link str_new}
* @see https://www.sqlite.org/c3ref/str_append.html
* @param str `sqlite3_str` pointer
*/
str_finish(str: number): void;

/**
* Extract a value from `sqlite3_value`
*
Expand Down
2 changes: 0 additions & 2 deletions test/api.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { TestContext } from "./TestContext.js";
import { api_exec } from "./api_exec.js";
import { api_misc } from "./api_misc.js";
import { api_prepare } from "./api_prepare.js";
import { api_statements } from "./api_statements.js";

function apiSpecs(build, config) {
Expand All @@ -10,7 +9,6 @@ function apiSpecs(build, config) {
describe(`SQLite ${build} ${config}`, function() {
api_exec(context);
api_misc(context);
api_prepare(context);
api_statements(context);
});
}
Expand Down
46 changes: 0 additions & 46 deletions test/api_prepare.js

This file was deleted.