Skip to content

Commit

Permalink
feat(Statement): add iter method to iterate with params (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
prasannavl authored Aug 6, 2024
1 parent cd61ef0 commit 35156ce
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/statement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -698,8 +698,9 @@ export class Statement {
}

/** Iterate over resultant rows from query. */
*[Symbol.iterator](): IterableIterator<any> {
*iter(...params: RestBindParameters): IterableIterator<any> {
this.#begin();
this.#bindAll(params);
const getRowObject = this.getRowObject();
let status = sqlite3_step(this.#handle);
while (status === SQLITE3_ROW) {
Expand All @@ -712,6 +713,10 @@ export class Statement {
sqlite3_reset(this.#handle);
}

[Symbol.iterator](): IterableIterator<any> {
return this.iter();
}

[Symbol.dispose](): void {
this.finalize();
}
Expand Down

0 comments on commit 35156ce

Please sign in to comment.