Replies: 2 comments 7 replies
-
Find a workaround: async batchRun(sql: string, records: BindingSpec[]): Promise<void> {
for await (const stmt of this.sqlite3.statements(this.db, sql)) {
for (const record of records) {
this.sqlite3.bind_collection(stmt, record);
await this.sqlite3.step(stmt);
await this.sqlite3.reset(stmt);
// sqlite3_clear_bindings
const nBindings = this.sqlite3.bind_parameter_count(stmt);
for (let i = 1; i <= nBindings; ++i) {
this.sqlite3.bind_null(stmt, i);
}
}
}
} However, this will significantly impact performance when there are a large number of records. I hope that |
Beta Was this translation helpful? Give feedback.
0 replies
-
It's a reasonable thing to add. I'll put it on my TODO list, but not at high priority. The underlying C function is exported by the WebAssembly module (the argument to module._sqlite3_clear_bindings(stmt); |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Accroding to https://www.sqlite.org/c3ref/clear_bindings.html, to clear stmt binding,
sqlite3_clear_bindings
needs to be called.However, only
reset
is present in SQLiteAPI currently.P.S. What I want to implement is something like this:
Beta Was this translation helpful? Give feedback.
All reactions