Module
Node.SQLite
- Package
- purescript-node-sqlite
- Repository
- m-rinaldi/purescript-node-sqlite
#SQLiteError Source
data SQLiteErrorErrors that can occur when running a query.
SQLite'Exception: an error thrown by the underlying SQLite engine.SQLite'DecodeError: the rows returned by SQLite could not be decoded into the expected PureScript type.
Constructors
Instances
#Options Source
type Options = { allowExtension :: Boolean, allowUnknownNamedParameters :: Boolean, defensive :: Boolean, enableDoubleQuotedStringLiterals :: Boolean, enableForeignKeyConstraints :: Boolean, readOnly :: Boolean, timeout :: Int }Options for open.
readOnly: If true, the database is opened in read-only mode. If the database does not exist, opening it will fail.enableForeignKeyConstraints: If true, foreign key constraints are enabled. This is recommended but can be disabled for compatibility with legacy database schemas. The enforcement of foreign key constraints can be enabled and disabled after opening the database using PRAGMA foreign_keys.enableDoubleQuotedStringLiterals: If true, SQLite will accept double-quoted string literals. This is not recommended but can be enabled for compatibility with legacy database schemas.allowExtension: If true, theloadExtensionSQL function and theloadExtension()method are enabled.timeoutThe busy timeout in milliseconds. This is the maximum amount of time that SQLite will wait for a database lock to be released before returning an error.allowUnknownNamedParameters: If true, unknown named parameters are ignored when binding. If false, an exception is thrown for unknown named parameters.defensive: If true, enables the defensive flag. When the defensive flag is enabled, language features that allow ordinary SQL to deliberately corrupt the database file are disabled.
#all Source
all :: forall @r rl m inputR. RowToList r rl => DecodeSQL (Array (Record r)) => Encode (Record inputR) => MonadEffect m => Statement inputR r -> Record inputR -> ExceptT SQLiteError m (Array (Record r))all runs a SELECT (or any row-returning statement, e.g. a RETURNING
clause) and returns every matching row as an array. Use it when you expect
zero or more rows.
#defaultOptions Source
defaultOptions :: OptionsDefault options for open. Foreign keys are enabled and the defensive flag is on;
everything else is disabled and the busy timeout is 0.
#get Source
get :: forall @r rl m iR. RowToList r rl => DecodeSQL (Maybe (Record r)) => Encode (Record iR) => MonadEffect m => Statement iR r -> Record iR -> ExceptT SQLiteError m (Maybe (Record r))get runs a SELECT (or any row-returning statement) and returns the
first matching row, or Nothing if no rows matched. Use it for lookups
that yield at most one row (e.g. a primary-key or LIMIT 1 query).