Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1913a4a

Browse filesBrowse files
cjihrigtargos
authored andcommitted
sqlite: restore changes from #55373
PR #55373 introduced a performance improvement for the all() method of prepared statements. Those changes appear to have been accidentally overwritten in #54181. This change restores the overwritten code. Refs: #55373 Refs: #54181 PR-URL: #56908 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 915d7ae commit 1913a4a
Copy full SHA for 1913a4a

File tree

Expand file treeCollapse file tree

1 file changed

+10
-6
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-6
lines changed
Open diff view settings
Collapse file

‎src/node_sqlite.cc‎

Copy file name to clipboardExpand all lines: src/node_sqlite.cc
+10-6Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.