Skip to content

Scripting API / core/local-app/LocalDatabaseApi

core/local-app/LocalDatabaseApi

Classes

LocalDatabaseApi

Methods

connect()

connect(dsn): Promise<LocalDatabaseConnection>

Connects to a local database.

Parameters
Parameter Type Description
dsn string The Data Source Name (DSN) for the connection
Returns

Promise<LocalDatabaseConnection>

LocalDatabaseConnection


LocalDatabaseConnection

Methods

execute()

execute(queryId, parameters?): Promise<number | { columns?: string[]; rows: any[][]; } | null>

Executes the given query with the given parameters (if provided) on the local database.

Parameters
Parameter Type Description
queryId number The ID of the query to execute
parameters? unknown[] Parameters to bind in to the query
Returns

Promise<number | { columns?: string[]; rows: any[][]; } | null>

If the executed query returns rows of data, then an object with both the rows and the column names (if applicable) will be returned. If the executed query returns the number of rows affected, then that number will be returned. If the executed query returns nothing, returns null.