File tree 1 file changed +10
-6
lines changed 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) {
1510
1510
auto reset = OnScopeLeave ([&]() { sqlite3_reset (stmt->statement_ ); });
1511
1511
int num_cols = sqlite3_column_count (stmt->statement_ );
1512
1512
LocalVector<Value> rows (isolate);
1513
+ LocalVector<Name> row_keys (isolate);
1513
1514
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
+
1516
1524
LocalVector<Value> row_values (isolate);
1517
1525
row_values.reserve (num_cols);
1518
-
1519
1526
for (int i = 0 ; i < num_cols; ++i) {
1520
- Local<Name> key;
1521
- if (!stmt->ColumnNameToName (i).ToLocal (&key)) return ;
1522
1527
Local<Value> val;
1523
1528
if (!stmt->ColumnToValue (i).ToLocal (&val)) return ;
1524
- row_keys.emplace_back (key);
1525
1529
row_values.emplace_back (val);
1526
1530
}
1527
1531
You can’t perform that action at this time.
0 commit comments