sqlite: read column count after step in StatementSync.all()

Signed-off-by: Guilherme Araújo <arauujogui@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/64219
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Guilherme Araújo authored and GitHub committed 2026-07-07 12:40:43 +00:00
1 parent 4a62a61092
commit 47e332d227
2 files changed
+74 -1

No files matched your search

+5 -1
View File
@@ -2865,12 +2865,16 @@ MaybeLocal<Value> StatementExecutionHelper::All(Environment* env,
Isolate* isolate = env->isolate();
EscapableHandleScope scope(isolate);
int r;
int num_cols = sqlite3_column_count(stmt);
int num_cols = 0;
LocalVector<Value> rows(isolate);
LocalVector<Value> row_values(isolate);
LocalVector<Name> row_keys(isolate);
while ((r = sqlite3_step(stmt)) == SQLITE_ROW) {
if (num_cols == 0) {
num_cols = sqlite3_column_count(stmt);
}
if (ExtractRowValues(env, stmt, num_cols, use_big_ints, &row_values)
.IsNothing()) {
return MaybeLocal<Value>();