UNPKG

db-conn-pgsql

Version:

Database Connecton Postgres SQL

39 lines 1.02 kB
import { toAnsiTypeColumns, toAnsiValueRows } from "./PgSqlUtils.js"; export class PgSqlResultSet { cursor; rows; client; firstTime; metadata; constructor(cursor, client) { this.cursor = cursor; this.client = client; this.firstTime = true; } async init() { this.firstTime = true; const row = await this.cursor.read(1); this.metadata = toAnsiTypeColumns(this.cursor['_result'].fields); this.rows = toAnsiValueRows(row, this.metadata); } async next() { if (this.firstTime) { this.firstTime = false; } else { const row = await this.cursor.read(1); this.rows = toAnsiValueRows(row, this.metadata); } return (this.rows.length > 0); } async getMetadata() { return this.metadata; } getRow() { return this.rows[0]; } async close() { await this.cursor.close(); } } //# sourceMappingURL=PgSqlResultSet.js.map