SqlValueA value bindable as a SQL parameter or returned in a Row.
@s2script/sdk/db
engine-generic async SQLite database.
import { SqlValue } from "@s2script/sdk/db";Author-time types ship in the npm package; the engine injects the runtime at plugin load. Add @s2script/sdk to your plugin's dependencies.
Generated from the shipped type definitions.
SqlValueA value bindable as a SQL parameter or returned in a Row.
RowOne query result row — a column-name→SqlValue map.
ExecuteResultThe outcome of a non-SELECT statement run via Database.execute.
changes: numberlastInsertId: numberDriverConnectionA driver-owned connection — what a Driver hands back from Driver.connect.
query(sql: string, params?: SqlValue[]): Promise<Row[]>params bind ? placeholders.execute(sql: string, params?: SqlValue[]): Promise<ExecuteResult>params bind ? placeholders.close(): Promise<void>ConnectionConfigNamed-connection config resolved by Database.open and passed to Driver.connect.
driver: string"sqlite").name: stringDriverA registered database backend; register a custom one via Database.registerDriver.
readonly name: stringconnect(config: ConnectionConfig): Promise<DriverConnection>config, resolving a DriverConnection.DatabaseA live database connection (delegates to its driver).
query(sql: string, params?: SqlValue[]): Promise<Row[]>params bind ? placeholders.execute(sql: string, params?: SqlValue[]): Promise<ExecuteResult>params bind ? placeholders.close(): Promise<void>DatabaseEntry point for opening databases and registering drivers.
open(name?: string): Promise<Database>Open a connection by name (default "default"). Resolves the driver + config, then connects.
"default".Returns — Resolves the connected Database handle.
Throws — Rejects if the name is unknown or the driver fails to connect.
import { Database } from "@s2script/sdk/db";
const db = await Database.open("clientprefs");
await db.execute("CREATE TABLE IF NOT EXISTS cookies (steamid TEXT, name TEXT, value TEXT)");
const rows = await db.query("SELECT value FROM cookies WHERE steamid = ?", ["76561199999999999"]);registerDriver(driver: Driver): void