Repository navigation
v0.3.5
This version adds a guard for the SQL text of a caller, and a function that gives each statement of a text. The change is backward compatible.
confineToFile(db)keeps the SQL of anode:sqliteconnection on its file. It refusesATTACHof a file,VACUUM INTO, the pragmastemp_store_directoryanddata_store_directory, and the functionload_extension.- Each other statement runs as before. A plain
VACUUMandclearDatabasealso work. - The guard does not limit the time or the size of the work of a caller. An
ATTACH ''can fill the temporary folder until the close. The host sets these limits. - The guard is the authorizer of SQLite, so it sees the statement after the parse. Comments, case and quotes do not change the result.
- The guard needs
setAuthorizerof Node.js 24.10 or later. On an earlier Node.js,confineToFilethrows the newConfineUnavailableError(code: "CONFINE_UNAVAILABLE"). The package still runs on Node.js 22.13. - The type
ConfinableDatabaseis the part of a connection that the guard uses. eachStatement(db, sql)gives each statement of a SQL text in order. The functionprepareofnode:sqlitecompiles only the first statement, and it ignores the rest with no error.eachStatementcompiles the next statement after the run of the statement before it. Thus a script can make a table and then write to it.- The types
SourcedStatementandStatementSourceare the parts of a statement and a connection thateachStatementuses.
Runtime dependencies: none.