Skip to content

Commit 121cc0a

Browse files
committed
Improved number -> string conversion for parameters
1 parent 7a192be commit 121cc0a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

source/util.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,12 @@ ParamValues async_postgres::array_to_params(GLua::ILuaInterface* lua,
4545

4646
auto type = lua->GetType(-1);
4747
if (type == GLua::Type::String) {
48-
auto value = get_string(lua, -1);
49-
param.strings[i] = std::string(value.data(), value.size());
48+
param.strings[i] = get_string(lua, -1);
5049
param.values[i] = param.strings[i].c_str();
51-
param.lengths[i] = value.length();
50+
param.lengths[i] = param.strings[i].length();
5251
param.formats[i] = 1;
5352
} else if (type == GLua::Type::Number) {
54-
param.strings[i] = std::to_string(lua->GetNumber(-1));
53+
param.strings[i] = get_string(lua, -1);
5554
param.values[i] = param.strings[i].c_str();
5655
} else if (type == GLua::Type::Bool) {
5756
param.values[i] = lua->GetBool(-1) ? "true" : "false";

0 commit comments

Comments
 (0)