bindings/javascript: Implement Statement.iterate()

This commit is contained in:
Pekka Enberg
2025-08-07 14:25:59 +03:00
parent b603ee7062
commit ab7b0dd1aa
2 changed files with 33 additions and 3 deletions

View File

@@ -319,7 +319,22 @@ class Statement {
* @param bindParameters - The bind parameters for executing the statement.
*/
*iterate(...bindParameters) {
throw new Error("not implemented");
this.stmt.reset();
bindParams(this.stmt, bindParameters);
while (true) {
const stepResult = this.stmt.step();
if (stepResult === STEP_IO) {
this.db.db.ioLoopSync();
continue;
}
if (stepResult === STEP_DONE) {
break;
}
if (stepResult === STEP_ROW) {
yield this.stmt.row();
}
}
}
/**