File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -1510,18 +1510,22 @@ void StatementSync::All(const FunctionCallbackInfo<Value>& args) {
15101510 auto reset = OnScopeLeave ([&]() { sqlite3_reset (stmt->statement_ ); });
15111511 int num_cols = sqlite3_column_count (stmt->statement_ );
15121512 LocalVector<Value> rows (isolate);
1513+ LocalVector<Name> row_keys (isolate);
15131514 while ((r = sqlite3_step (stmt->statement_ )) == SQLITE_ROW) {
1514- LocalVector<Name> row_keys (isolate);
1515- row_keys.reserve (num_cols);
1515+ if (row_keys.size () == 0 ) {
1516+ row_keys.reserve (num_cols);
1517+ for (int i = 0 ; i < num_cols; ++i) {
1518+ Local<Name> key;
1519+ if (!stmt->ColumnNameToName (i).ToLocal (&key)) return ;
1520+ row_keys.emplace_back (key);
1521+ }
1522+ }
1523+
15161524 LocalVector<Value> row_values (isolate);
15171525 row_values.reserve (num_cols);
1518-
15191526 for (int i = 0 ; i < num_cols; ++i) {
1520- Local<Name> key;
1521- if (!stmt->ColumnNameToName (i).ToLocal (&key)) return ;
15221527 Local<Value> val;
15231528 if (!stmt->ColumnToValue (i).ToLocal (&val)) return ;
1524- row_keys.emplace_back (key);
15251529 row_values.emplace_back (val);
15261530 }
15271531
You can’t perform that action at this time.
0 commit comments