From 35156ced89af2939176c9604dd3a4cf9c2a4e03c Mon Sep 17 00:00:00 2001 From: Prasanna Loganathar Date: Tue, 6 Aug 2024 10:23:43 +0800 Subject: [PATCH] feat(Statement): add iter method to iterate with params (#133) --- src/statement.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/statement.ts b/src/statement.ts index aca3c27..1d33c7c 100644 --- a/src/statement.ts +++ b/src/statement.ts @@ -698,8 +698,9 @@ export class Statement { } /** Iterate over resultant rows from query. */ - *[Symbol.iterator](): IterableIterator { + *iter(...params: RestBindParameters): IterableIterator { this.#begin(); + this.#bindAll(params); const getRowObject = this.getRowObject(); let status = sqlite3_step(this.#handle); while (status === SQLITE3_ROW) { @@ -712,6 +713,10 @@ export class Statement { sqlite3_reset(this.#handle); } + [Symbol.iterator](): IterableIterator { + return this.iter(); + } + [Symbol.dispose](): void { this.finalize(); }