Database

SQLite. Database

This class represents a single connection to a SQLite database.

Constructor

new Database(path, optionsopt) → {Database}

Creates a new SQLite database instance.

Source:
Parameters:
Name Type Attributes Description
path String

The path of the database.

options Object <optional>

Configuration options for the database connection.

Name Type Attributes Description
open boolean <optional>

If true, the database is opened by the constructor.

readOnly boolean <optional>

If true, the database is opened in read-only mode.

allowExtention boolean <optional>

If true, loading extentions is enabled.

Returns:
Type:
Database

Members

isOpen

Returns whether the database is currently open or not.

Source:

Methods

close()

Closes the database connection.

Source:

enableLoadExtension(allow)

Enables or disables the loadExtension SQL function.

Source:
Parameters:
Name Type Default Description
allow boolean true

Whether to allow loading extensions.

exec(sql)

Executes SQL statements without returning any results.

Source:
Parameters:
Name Type Description
sql String

A SQL string to execute.

loadExtension(path)

Loads a shared library into the database connection.

Source:
Parameters:
Name Type Description
path String

The path to the shared library to load.

open()

Opens the database specified in the path argument.

Source:

prepare(sql)

Compiles a SQL statement into a prepared statement.

Source:
Parameters:
Name Type Description
sql String

A SQL string to execute.