Repository navigation
v0.3.3
This version adds the parts that the SQLite stores of other packages keep as local copies. The change is backward compatible.
openDatabasetakesreadOnly: the connection reads an existing file and does not change it. The optionwalalso takes"when-writable": a file that the process cannot write keeps its journal mode. The typeWalModeis new.transactiontakescommit: false: a dry run. The function rolls back after the work and gives the result of the work. This also applies to a savepoint.checkpointrunsPRAGMA wal_checkpointand gives its counts. The typesCheckpointMode,CheckpointedandCheckpointDatabaseare new.clearDatabasedrops each view and each table, and setsuser_versionto 0, for a cache that makes its tables again. The typeClearOptionsis new.sqlJsConnectiongives aSqlConnectionover a database of sql.js. The typesSqlJsDatabase,SqlJsStatement,SqlJsValueandSqlJsConnectionare structural, so the package has no new dependency.- Both entries export the new functions and types.
WalModeis only in the main entry. openDatabaseandsalvageEventLoguse the classDatabaseofnode:sqlitewhen it is there. Node.js 26.11 renamedDatabaseSynctoDatabase, and the old name gives a deprecation warning (DEP0210).- A Node.js before 22.16 has no
isTransaction. ThenopenDatabaseadds it to the connection as a probe: aBEGIN, which SQLite refuses in a transaction.sqlJsConnectionuses the same probe. Theenginesfield does not change. - One suite of tests runs the portable entry on
node:sqlite, SQLite in WebAssembly and sql.js.
Runtime dependencies: none.