property
sqlite.Statement.columnTypes
readonly columnTypes: null | 'TEXT' | 'INTEGER' | 'FLOAT' | 'BLOB' | 'NULL'[]
The actual SQLite column types from the first row of the result set, as reported by sqlite3_column_type(). Useful for expressions and computed columns, which are not covered by declaredTypes.
Returns an array of SQLite type constants as uppercase strings:
"INTEGER"for integer values"FLOAT"for floating-point values"TEXT"for text values"BLOB"for binary data"NULL"for null valuesnullfor unknown/unsupported types
Only available for read-only statements (SELECT queries). For other statements, accessing this property throws an error.
const stmt = db.prepare("SELECT id, name, age FROM users WHERE id = 1");
console.log(stmt.columnTypes);
// => ["INTEGER", "TEXT", "INTEGER"]
// For expressions:
const exprStmt = db.prepare("SELECT length('bun') AS str_length");
console.log(exprStmt.columnTypes);
// => ["INTEGER"]