Skip to content

Commit

Permalink
sqlite: remove unnecessary auto assignment
Browse files Browse the repository at this point in the history
Assignment is not necessary here at all.

PR-URL: #54686
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
  • Loading branch information
tniessen authored and aduh95 committed Sep 12, 2024
1 parent ebe91db commit 4c1b98b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/node_sqlite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ void DatabaseSync::Prepare(const FunctionCallbackInfo<Value>& args) {
return;
}

auto sql = node::Utf8Value(env->isolate(), args[0].As<String>());
node::Utf8Value sql(env->isolate(), args[0].As<String>());
sqlite3_stmt* s = nullptr;
int r = sqlite3_prepare_v2(db->connection_, *sql, -1, &s, 0);
CHECK_ERROR_OR_THROW(env->isolate(), db->connection_, r, SQLITE_OK, void());
Expand All @@ -234,7 +234,7 @@ void DatabaseSync::Exec(const FunctionCallbackInfo<Value>& args) {
return;
}

auto sql = node::Utf8Value(env->isolate(), args[0].As<String>());
node::Utf8Value sql(env->isolate(), args[0].As<String>());
int r = sqlite3_exec(db->connection_, *sql, nullptr, nullptr, nullptr);
CHECK_ERROR_OR_THROW(env->isolate(), db->connection_, r, SQLITE_OK, void());
}
Expand Down Expand Up @@ -322,7 +322,7 @@ bool StatementSync::BindParams(const FunctionCallbackInfo<Value>& args) {
return false;
}

auto utf8_key = node::Utf8Value(env()->isolate(), key);
node::Utf8Value utf8_key(env()->isolate(), key);
int r = sqlite3_bind_parameter_index(statement_, *utf8_key);
if (r == 0) {
if (allow_bare_named_params_) {
Expand Down Expand Up @@ -378,7 +378,7 @@ bool StatementSync::BindValue(const Local<Value>& value, const int index) {
double val = value.As<Number>()->Value();
r = sqlite3_bind_double(statement_, index, val);
} else if (value->IsString()) {
auto val = node::Utf8Value(env()->isolate(), value.As<String>());
node::Utf8Value val(env()->isolate(), value.As<String>());
r = sqlite3_bind_text(
statement_, index, *val, val.length(), SQLITE_TRANSIENT);
} else if (value->IsNull()) {
Expand Down

0 comments on commit 4c1b98b

Please sign in to comment.