Skip to content

Commit b648d37

Browse files
authored
src: use env strings to create sqlite results
PR-URL: nodejs#55785 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent e577618 commit b648d37

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/env_properties.h

+2
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
V(cached_data_string, "cachedData") \
9191
V(cache_key_string, "cacheKey") \
9292
V(change_string, "change") \
93+
V(changes_string, "changes") \
9394
V(channel_string, "channel") \
9495
V(chunks_sent_since_last_write_string, "chunksSentSinceLastWrite") \
9596
V(clone_unsupported_type_str, "Cannot clone object of unsupported type.") \
@@ -215,6 +216,7 @@
215216
V(jwk_y_string, "y") \
216217
V(kill_signal_string, "killSignal") \
217218
V(kind_string, "kind") \
219+
V(last_insert_rowid_string, "lastInsertRowid") \
218220
V(length_string, "length") \
219221
V(library_string, "library") \
220222
V(line_number_string, "lineNumber") \

src/node_sqlite.cc

+5-6
Original file line numberDiff line numberDiff line change
@@ -694,10 +694,6 @@ void StatementSync::Run(const FunctionCallbackInfo<Value>& args) {
694694
}
695695

696696
Local<Object> result = Object::New(env->isolate());
697-
Local<String> last_insert_rowid_string =
698-
FIXED_ONE_BYTE_STRING(env->isolate(), "lastInsertRowid");
699-
Local<String> changes_string =
700-
FIXED_ONE_BYTE_STRING(env->isolate(), "changes");
701697
sqlite3_int64 last_insert_rowid =
702698
sqlite3_last_insert_rowid(stmt->db_->Connection());
703699
sqlite3_int64 changes = sqlite3_changes64(stmt->db_->Connection());
@@ -713,9 +709,12 @@ void StatementSync::Run(const FunctionCallbackInfo<Value>& args) {
713709
}
714710

715711
if (result
716-
->Set(env->context(), last_insert_rowid_string, last_insert_rowid_val)
712+
->Set(env->context(),
713+
env->last_insert_rowid_string(),
714+
last_insert_rowid_val)
717715
.IsNothing() ||
718-
result->Set(env->context(), changes_string, changes_val).IsNothing()) {
716+
result->Set(env->context(), env->changes_string(), changes_val)
717+
.IsNothing()) {
719718
return;
720719
}
721720

0 commit comments

Comments
 (0)