0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 13:09:21 +01:00

src: use env strings to create sqlite results

PR-URL: https://github.com/nodejs/node/pull/55785
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Michaël Zasso 2024-11-17 10:25:03 +01:00 committed by GitHub
parent e577618227
commit b648d37ad7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 6 deletions

View File

@ -90,6 +90,7 @@
V(cached_data_string, "cachedData") \
V(cache_key_string, "cacheKey") \
V(change_string, "change") \
V(changes_string, "changes") \
V(channel_string, "channel") \
V(chunks_sent_since_last_write_string, "chunksSentSinceLastWrite") \
V(clone_unsupported_type_str, "Cannot clone object of unsupported type.") \
@ -215,6 +216,7 @@
V(jwk_y_string, "y") \
V(kill_signal_string, "killSignal") \
V(kind_string, "kind") \
V(last_insert_rowid_string, "lastInsertRowid") \
V(length_string, "length") \
V(library_string, "library") \
V(line_number_string, "lineNumber") \

View File

@ -694,10 +694,6 @@ void StatementSync::Run(const FunctionCallbackInfo<Value>& args) {
}
Local<Object> result = Object::New(env->isolate());
Local<String> last_insert_rowid_string =
FIXED_ONE_BYTE_STRING(env->isolate(), "lastInsertRowid");
Local<String> changes_string =
FIXED_ONE_BYTE_STRING(env->isolate(), "changes");
sqlite3_int64 last_insert_rowid =
sqlite3_last_insert_rowid(stmt->db_->Connection());
sqlite3_int64 changes = sqlite3_changes64(stmt->db_->Connection());
@ -713,9 +709,12 @@ void StatementSync::Run(const FunctionCallbackInfo<Value>& args) {
}
if (result
->Set(env->context(), last_insert_rowid_string, last_insert_rowid_val)
->Set(env->context(),
env->last_insert_rowid_string(),
last_insert_rowid_val)
.IsNothing() ||
result->Set(env->context(), changes_string, changes_val).IsNothing()) {
result->Set(env->context(), env->changes_string(), changes_val)
.IsNothing()) {
return;
}