Fix Statement.getAsObject cursor handling

This commit is contained in:
Jordan Wages 2025-09-24 06:24:09 -05:00
commit f2d246f63a

View file

@ -654,10 +654,11 @@
getAsObject() { getAsObject() {
try { try {
if (!this._columnNames) this._columnNames = this._stmt.getColumnNames(); if (!this._columnNames) this._columnNames = this._stmt.getColumnNames();
const values = this._stmt.get();
const row = Object.create(null); const row = Object.create(null);
const count = this._columnNames.length; const count = this._columnNames.length;
for (let i = 0; i < count; i += 1) { for (let i = 0; i < count; i += 1) {
row[this._columnNames[i]] = this._stmt.get(i); row[this._columnNames[i]] = values ? values[i] : undefined;
} }
return row; return row;
} catch (error) { } catch (error) {