run

Bun

Symbol

Statement.run

run(...params: ParamsType): Changes

Execute the prepared statement. This returns undefined.

@param params

optional values to bind to the statement. If omitted, the statement is run with the last bound values or no parameters if there are none.

const stmt = db.prepare("UPDATE foo SET bar = ?");
stmt.run("baz");
// => undefined

stmt.run();
// => undefined

stmt.run("foo");
// => undefined

The following types can be used when binding parameters:

JavaScript typeSQLite type
stringTEXT
numberINTEGER or DECIMAL
booleanINTEGER (1 or 0)
Uint8ArrayBLOB
BufferBLOB
bigintINTEGER
nullNULL

Referenced types

interface Changes

An object representing the changes made to the database since the last run or exec call.

  • changes: number

    The number of rows changed by the last run or exec call.

  • lastInsertRowid: number | bigint

    If safeIntegers is true, this is a bigint. Otherwise, it is a number.