Use QString::fromStdString

Just to keep things consistent in the whole round trip conversion
This commit is contained in:
Luis Ángel San Martín
2021-01-14 08:51:08 +01:00
parent 260f538de3
commit 7b36100458

View File

@ -53,9 +53,9 @@ int QueryParser::TreeNode::bindValues(QSqlQuery &selectQuery, int bindPosition)
if (t == "token") { if (t == "token") {
std::string bind_string(":bindPosition" + std::to_string(++bindPosition)); std::string bind_string(":bindPosition" + std::to_string(++bindPosition));
if (isIn(fieldType(children[0].t), { FieldType::numeric, FieldType::boolean })) { if (isIn(fieldType(children[0].t), { FieldType::numeric, FieldType::boolean })) {
selectQuery.bindValue(bind_string.c_str(), std::stoi(children[1].t)); selectQuery.bindValue(QString::fromStdString(bind_string), std::stoi(children[1].t));
} else { } else {
selectQuery.bindValue(bind_string.c_str(), ("%%" + children[1].t + "%%").c_str()); selectQuery.bindValue(QString::fromStdString(bind_string), QString::fromStdString("%%" + children[1].t + "%%"));
} }
} else if (t == "not") { } else if (t == "not") {
bindPosition = children[0].bindValues(selectQuery, bindPosition); bindPosition = children[0].bindValues(selectQuery, bindPosition);
@ -159,7 +159,7 @@ std::string QueryParser::join(const QStringList &strings, const std::string &del
QStringList QueryParser::split(const std::string &string, char delim) QStringList QueryParser::split(const std::string &string, char delim)
{ {
auto words = QString(string.c_str()).split(delim); auto words = QString::fromStdString(string).split(delim);
return words; return words;
} }