mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
sqlite: reserve vectors space
PR-URL: https://github.com/nodejs/node/pull/61540 Reviewed-By: René <contact.9a5d6388@renegade334.me.uk> Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
This commit is contained in:
1 parent
ca3d4e0cd3
commit
68d7b6f870
1 file changed
+12
-11
+12
-11
@@ -322,6 +322,8 @@ class CustomAggregate {
|
||||
|
||||
auto recv = Undefined(isolate);
|
||||
LocalVector<Value> js_argv(isolate);
|
||||
js_argv.reserve(argc + 1);
|
||||
|
||||
js_argv.emplace_back(Local<Value>::New(isolate, agg->value));
|
||||
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
@@ -625,6 +627,7 @@ void UserDefinedFunction::xFunc(sqlite3_context* ctx,
|
||||
auto recv = Undefined(isolate);
|
||||
auto fn = self->fn_.Get(isolate);
|
||||
LocalVector<Value> js_argv(isolate);
|
||||
js_argv.reserve(argc);
|
||||
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
sqlite3_value* value = argv[i];
|
||||
@@ -2063,18 +2066,16 @@ int DatabaseSync::AuthorizerCallback(void* user_data,
|
||||
CHECK(cb->IsFunction());
|
||||
|
||||
Local<Function> callback = cb.As<Function>();
|
||||
LocalVector<Value> js_argv(isolate);
|
||||
|
||||
// Convert SQLite authorizer parameters to JavaScript values
|
||||
js_argv.emplace_back(Integer::New(isolate, action_code));
|
||||
js_argv.emplace_back(
|
||||
NullableSQLiteStringToValue(isolate, param1).ToLocalChecked());
|
||||
js_argv.emplace_back(
|
||||
NullableSQLiteStringToValue(isolate, param2).ToLocalChecked());
|
||||
js_argv.emplace_back(
|
||||
NullableSQLiteStringToValue(isolate, param3).ToLocalChecked());
|
||||
js_argv.emplace_back(
|
||||
NullableSQLiteStringToValue(isolate, param4).ToLocalChecked());
|
||||
LocalVector<Value> js_argv(
|
||||
isolate,
|
||||
{
|
||||
Integer::New(isolate, action_code),
|
||||
NullableSQLiteStringToValue(isolate, param1).ToLocalChecked(),
|
||||
NullableSQLiteStringToValue(isolate, param2).ToLocalChecked(),
|
||||
NullableSQLiteStringToValue(isolate, param3).ToLocalChecked(),
|
||||
NullableSQLiteStringToValue(isolate, param4).ToLocalChecked(),
|
||||
});
|
||||
|
||||
MaybeLocal<Value> retval = callback->Call(
|
||||
context, Undefined(isolate), js_argv.size(), js_argv.data());
|
||||
|
||||
Reference in new issue
Block a user