Interface ResultSet

Result of executing an SQL statement.

const rs = await client.execute("SELECT name, title FROM books");
console.log(`Found ${rs.rows.length} books`);
for (const row in rs.rows) {
console.log(`Book ${row[0]} by ${row[1]}`);
}

const rs = await client.execute("DELETE FROM books WHERE author = 'Jane Austen'");
console.log(`Deleted ${rs.rowsAffected} books`);

Hierarchy

  • ResultSet

Properties

columnTypes: string[]

Types of columns.

The types are currently shown for types declared in a SQL table. For column types of function calls, for example, an empty string is returned.

columns: string[]

Names of columns.

Names of columns can be defined using the AS keyword in SQL:

SELECT author AS author, COUNT(*) AS count FROM books GROUP BY author
lastInsertRowid: undefined | bigint

ROWID of the last inserted row.

This value is not specified if the SQL statement was not an INSERT or if the table was not a ROWID table.

rows: Row[]

Rows produced by the statement.

rowsAffected: number

Number of rows that were affected by an UPDATE, INSERT or DELETE operation.

This value is not specified for other SQL statements.

Methods

  • Converts the result set to JSON.

    This is used automatically by JSON.stringify(), but you can also call it explicitly.

    Returns any

Generated using TypeDoc