Use String.empty() instead of comparing a string to "", in the QueryBuilder.

This commit is contained in:
Relintai 2022-12-27 18:20:01 +01:00
parent 093ee3e592
commit db534a3da6
2 changed files with 8 additions and 8 deletions

View File

@ -191,7 +191,7 @@ QueryBuilder *QueryBuilder::order_by_desc(const String &col) {
return this;
}
QueryBuilder *QueryBuilder::order_by(const String &col) {
if (col == "") {
if (col.empty()) {
query_result += "ORDER BY ";
} else {
query_result += "ORDER BY " + col + ", ";
@ -213,7 +213,7 @@ QueryBuilder *QueryBuilder::order_by_add_col(const String &col) {
return this;
}
QueryBuilder *QueryBuilder::asc(const String &col) {
if (col == "") {
if (col.empty()) {
query_result += "ASC, ";
} else {
query_result += col + " ASC, ";
@ -222,7 +222,7 @@ QueryBuilder *QueryBuilder::asc(const String &col) {
return this;
}
QueryBuilder *QueryBuilder::desc(const String &col) {
if (col == "") {
if (col.empty()) {
query_result += "DESC, ";
} else {
query_result += col + " DESC, ";

View File

@ -94,7 +94,7 @@ QueryBuilder *SQLite3QueryBuilder::ndel(const String &params) {
QueryBuilder *SQLite3QueryBuilder::nwhere(const String &params) {
query_result += "WHERE ";
if (params != "") {
if (!params.empty()) {
query_result += params;
query_result += " ";
}
@ -105,7 +105,7 @@ QueryBuilder *SQLite3QueryBuilder::nwhere(const String &params) {
QueryBuilder *SQLite3QueryBuilder::nfrom(const String &params) {
query_result += "FROM ";
if (params != "") {
if (!params.empty()) {
query_result += params;
query_result += " ";
}
@ -116,12 +116,12 @@ QueryBuilder *SQLite3QueryBuilder::nfrom(const String &params) {
QueryBuilder *SQLite3QueryBuilder::insert(const String &table_name, const String &columns) {
query_result += "INSERT INTO ";
if (table_name != "") {
if (!table_name.empty()) {
query_result += table_name;
query_result += " ";
}
if (columns != "") {
if (!columns.empty()) {
query_result += "(";
query_result += columns;
query_result += ") ";
@ -132,7 +132,7 @@ QueryBuilder *SQLite3QueryBuilder::insert(const String &table_name, const String
QueryBuilder *SQLite3QueryBuilder::nvalues(const String &params_str) {
query_result += "VALUES(";
if (params_str != "") {
if (!params_str.empty()) {
query_result += params_str;
query_result += ") ";
}