mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-22 11:56:49 +01:00
QueryBuilder now uses a StringBuilder internally.
This commit is contained in:
parent
eebeadbe47
commit
04ef468ffa
@ -38,7 +38,8 @@ String QueryBuilder::get_result() {
|
|||||||
return query_result;
|
return query_result;
|
||||||
}
|
}
|
||||||
void QueryBuilder::set_result(const String &val) {
|
void QueryBuilder::set_result(const String &val) {
|
||||||
query_result = val;
|
query_result.clear();
|
||||||
|
query_result.append(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder *QueryBuilder::select() {
|
QueryBuilder *QueryBuilder::select() {
|
||||||
@ -235,7 +236,12 @@ QueryBuilder *QueryBuilder::order_by(const String &col) {
|
|||||||
QueryBuilder *QueryBuilder::corder_by() {
|
QueryBuilder *QueryBuilder::corder_by() {
|
||||||
ERR_FAIL_COND_V(query_result.length() <= 2, this);
|
ERR_FAIL_COND_V(query_result.length() <= 2, this);
|
||||||
|
|
||||||
query_result[query_result.length() - 2] = ' ';
|
String qr = query_result.as_string();
|
||||||
|
|
||||||
|
qr[qr.length() - 2] = ' ';
|
||||||
|
|
||||||
|
query_result.clear();
|
||||||
|
query_result.append(qr);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -307,7 +313,7 @@ QueryBuilder *QueryBuilder::end_command() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder *QueryBuilder::reset() {
|
QueryBuilder *QueryBuilder::reset() {
|
||||||
query_result = "";
|
query_result.clear();
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#include "core/string/ustring.h"
|
#include "core/string/ustring.h"
|
||||||
|
#include "core/string/string_builder.h"
|
||||||
|
|
||||||
#include "core/object/reference.h"
|
#include "core/object/reference.h"
|
||||||
|
|
||||||
@ -245,7 +246,7 @@ protected:
|
|||||||
|
|
||||||
Ref<QueryBuilder> _reset_bind();
|
Ref<QueryBuilder> _reset_bind();
|
||||||
|
|
||||||
String query_result;
|
StringBuilder query_result;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -24,7 +24,12 @@ QueryBuilder *SQLite3QueryBuilder::del() {
|
|||||||
QueryBuilder *SQLite3QueryBuilder::cvalues() {
|
QueryBuilder *SQLite3QueryBuilder::cvalues() {
|
||||||
ERR_FAIL_COND_V(query_result.length() <= 2, this);
|
ERR_FAIL_COND_V(query_result.length() <= 2, this);
|
||||||
|
|
||||||
query_result[query_result.length() - 2] = ' ';
|
String qr = query_result.as_string();
|
||||||
|
|
||||||
|
qr[qr.length() - 2] = ' ';
|
||||||
|
|
||||||
|
query_result.clear();
|
||||||
|
query_result.append(qr);
|
||||||
query_result += ") ";
|
query_result += ") ";
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
@ -32,7 +37,12 @@ QueryBuilder *SQLite3QueryBuilder::cvalues() {
|
|||||||
QueryBuilder *SQLite3QueryBuilder::next_value() {
|
QueryBuilder *SQLite3QueryBuilder::next_value() {
|
||||||
ERR_FAIL_COND_V(query_result.length() <= 2, this);
|
ERR_FAIL_COND_V(query_result.length() <= 2, this);
|
||||||
|
|
||||||
query_result[query_result.length() - 2] = ' ';
|
String qr = query_result.as_string();
|
||||||
|
|
||||||
|
qr[qr.length() - 2] = ' ';
|
||||||
|
|
||||||
|
query_result.clear();
|
||||||
|
query_result.append(qr);
|
||||||
query_result += "), (";
|
query_result += "), (";
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
@ -215,7 +225,12 @@ QueryBuilder *SQLite3QueryBuilder::sets() {
|
|||||||
QueryBuilder *SQLite3QueryBuilder::cset() {
|
QueryBuilder *SQLite3QueryBuilder::cset() {
|
||||||
ERR_FAIL_COND_V(query_result.length() <= 2, this);
|
ERR_FAIL_COND_V(query_result.length() <= 2, this);
|
||||||
|
|
||||||
query_result[query_result.length() - 2] = ' ';
|
String qr = query_result.as_string();
|
||||||
|
|
||||||
|
qr[qr.length() - 2] = ' ';
|
||||||
|
|
||||||
|
query_result.clear();
|
||||||
|
query_result.append(qr);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user