mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-25 13:17:22 +01:00
Use String.empty() instead of comparing a string to "", in the QueryBuilder.
This commit is contained in:
parent
093ee3e592
commit
db534a3da6
@ -191,7 +191,7 @@ QueryBuilder *QueryBuilder::order_by_desc(const String &col) {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
QueryBuilder *QueryBuilder::order_by(const String &col) {
|
QueryBuilder *QueryBuilder::order_by(const String &col) {
|
||||||
if (col == "") {
|
if (col.empty()) {
|
||||||
query_result += "ORDER BY ";
|
query_result += "ORDER BY ";
|
||||||
} else {
|
} else {
|
||||||
query_result += "ORDER BY " + col + ", ";
|
query_result += "ORDER BY " + col + ", ";
|
||||||
@ -213,7 +213,7 @@ QueryBuilder *QueryBuilder::order_by_add_col(const String &col) {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
QueryBuilder *QueryBuilder::asc(const String &col) {
|
QueryBuilder *QueryBuilder::asc(const String &col) {
|
||||||
if (col == "") {
|
if (col.empty()) {
|
||||||
query_result += "ASC, ";
|
query_result += "ASC, ";
|
||||||
} else {
|
} else {
|
||||||
query_result += col + " ASC, ";
|
query_result += col + " ASC, ";
|
||||||
@ -222,7 +222,7 @@ QueryBuilder *QueryBuilder::asc(const String &col) {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
QueryBuilder *QueryBuilder::desc(const String &col) {
|
QueryBuilder *QueryBuilder::desc(const String &col) {
|
||||||
if (col == "") {
|
if (col.empty()) {
|
||||||
query_result += "DESC, ";
|
query_result += "DESC, ";
|
||||||
} else {
|
} else {
|
||||||
query_result += col + " DESC, ";
|
query_result += col + " DESC, ";
|
||||||
|
@ -94,7 +94,7 @@ QueryBuilder *SQLite3QueryBuilder::ndel(const String ¶ms) {
|
|||||||
QueryBuilder *SQLite3QueryBuilder::nwhere(const String ¶ms) {
|
QueryBuilder *SQLite3QueryBuilder::nwhere(const String ¶ms) {
|
||||||
query_result += "WHERE ";
|
query_result += "WHERE ";
|
||||||
|
|
||||||
if (params != "") {
|
if (!params.empty()) {
|
||||||
query_result += params;
|
query_result += params;
|
||||||
query_result += " ";
|
query_result += " ";
|
||||||
}
|
}
|
||||||
@ -105,7 +105,7 @@ QueryBuilder *SQLite3QueryBuilder::nwhere(const String ¶ms) {
|
|||||||
QueryBuilder *SQLite3QueryBuilder::nfrom(const String ¶ms) {
|
QueryBuilder *SQLite3QueryBuilder::nfrom(const String ¶ms) {
|
||||||
query_result += "FROM ";
|
query_result += "FROM ";
|
||||||
|
|
||||||
if (params != "") {
|
if (!params.empty()) {
|
||||||
query_result += params;
|
query_result += params;
|
||||||
query_result += " ";
|
query_result += " ";
|
||||||
}
|
}
|
||||||
@ -116,12 +116,12 @@ QueryBuilder *SQLite3QueryBuilder::nfrom(const String ¶ms) {
|
|||||||
QueryBuilder *SQLite3QueryBuilder::insert(const String &table_name, const String &columns) {
|
QueryBuilder *SQLite3QueryBuilder::insert(const String &table_name, const String &columns) {
|
||||||
query_result += "INSERT INTO ";
|
query_result += "INSERT INTO ";
|
||||||
|
|
||||||
if (table_name != "") {
|
if (!table_name.empty()) {
|
||||||
query_result += table_name;
|
query_result += table_name;
|
||||||
query_result += " ";
|
query_result += " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (columns != "") {
|
if (!columns.empty()) {
|
||||||
query_result += "(";
|
query_result += "(";
|
||||||
query_result += columns;
|
query_result += columns;
|
||||||
query_result += ") ";
|
query_result += ") ";
|
||||||
@ -132,7 +132,7 @@ QueryBuilder *SQLite3QueryBuilder::insert(const String &table_name, const String
|
|||||||
QueryBuilder *SQLite3QueryBuilder::nvalues(const String ¶ms_str) {
|
QueryBuilder *SQLite3QueryBuilder::nvalues(const String ¶ms_str) {
|
||||||
query_result += "VALUES(";
|
query_result += "VALUES(";
|
||||||
|
|
||||||
if (params_str != "") {
|
if (!params_str.empty()) {
|
||||||
query_result += params_str;
|
query_result += params_str;
|
||||||
query_result += ") ";
|
query_result += ") ";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user