mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-23 01:27:17 +01:00
Use String length() instead of size() in QueryBuilder, also guard against overindexing.
This commit is contained in:
parent
3d63a84be9
commit
cb409757c3
@ -201,7 +201,9 @@ QueryBuilder *QueryBuilder::order_by(const String &col) {
|
||||
}
|
||||
|
||||
QueryBuilder *QueryBuilder::corder_by() {
|
||||
query_result[query_result.size() - 2] = ' ';
|
||||
ERR_FAIL_COND_V(query_result.length() <= 2, this);
|
||||
|
||||
query_result[query_result.length() - 2] = ' ';
|
||||
|
||||
return this;
|
||||
}
|
||||
@ -212,7 +214,7 @@ QueryBuilder *QueryBuilder::order_by_add_col(const String &col) {
|
||||
}
|
||||
QueryBuilder *QueryBuilder::asc(const String &col) {
|
||||
if (col == "") {
|
||||
query_result += "ASC,";
|
||||
query_result += "ASC, ";
|
||||
} else {
|
||||
query_result += col + " ASC, ";
|
||||
}
|
||||
|
@ -21,12 +21,16 @@ QueryBuilder *SQLite3QueryBuilder::del() {
|
||||
}
|
||||
|
||||
QueryBuilder *SQLite3QueryBuilder::cvalues() {
|
||||
ERR_FAIL_COND_V(query_result.length() <= 2, this);
|
||||
|
||||
query_result[query_result.length() - 2] = ' ';
|
||||
query_result += ") ";
|
||||
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *SQLite3QueryBuilder::next_value() {
|
||||
ERR_FAIL_COND_V(query_result.length() <= 2, this);
|
||||
|
||||
query_result[query_result.length() - 2] = ' ';
|
||||
query_result += "), (";
|
||||
|
||||
@ -208,6 +212,8 @@ QueryBuilder *SQLite3QueryBuilder::sets() {
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *SQLite3QueryBuilder::cset() {
|
||||
ERR_FAIL_COND_V(query_result.length() <= 2, this);
|
||||
|
||||
query_result[query_result.length() - 2] = ' ';
|
||||
|
||||
return this;
|
||||
|
Loading…
Reference in New Issue
Block a user