mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-24 12:47:12 +01:00
Finished cleaning up QueryBuilder.
This commit is contained in:
parent
f9bbf772ca
commit
134d94af5f
@ -12,18 +12,6 @@ QueryBuilder *QueryBuilder::del() {
|
||||
return this;
|
||||
}
|
||||
|
||||
QueryBuilder *QueryBuilder::where() {
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *QueryBuilder::from() {
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *QueryBuilder::insert() {
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *QueryBuilder::values() {
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *QueryBuilder::cvalues() {
|
||||
return this;
|
||||
}
|
||||
@ -51,10 +39,6 @@ QueryBuilder *QueryBuilder::cstr() {
|
||||
return this;
|
||||
}
|
||||
|
||||
QueryBuilder *QueryBuilder::like() {
|
||||
return this;
|
||||
}
|
||||
|
||||
QueryBuilder *QueryBuilder::select(const String ¶ms) {
|
||||
return nselect(escape(params));
|
||||
}
|
||||
@ -109,7 +93,7 @@ QueryBuilder *QueryBuilder::like(const String &str) {
|
||||
return nlike(escape(str));
|
||||
}
|
||||
|
||||
QueryBuilder *QueryBuilder::set() {
|
||||
QueryBuilder *QueryBuilder::sets() {
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *QueryBuilder::cset() {
|
||||
@ -200,43 +184,40 @@ QueryBuilder *QueryBuilder::order_by_desc(const String &col) {
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *QueryBuilder::order_by(const String &col) {
|
||||
query_result += "ORDER BY " + col + ", ";
|
||||
if (col == "") {
|
||||
query_result += "ORDER BY ";
|
||||
} else {
|
||||
query_result += "ORDER BY " + col + ", ";
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
QueryBuilder *QueryBuilder::order_by() {
|
||||
query_result += "ORDER BY ";
|
||||
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *QueryBuilder::corder_by() {
|
||||
query_result[query_result.size() - 2] = ' ';
|
||||
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *QueryBuilder::asc() {
|
||||
query_result += "ASC, ";
|
||||
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *QueryBuilder::desc() {
|
||||
query_result += "DESC, ";
|
||||
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *QueryBuilder::order_by_add_col(const String &col) {
|
||||
query_result += col + ", ";
|
||||
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *QueryBuilder::asc(const String &col) {
|
||||
query_result += col + " ASC, ";
|
||||
if (col == "") {
|
||||
query_result += "ASC,";
|
||||
} else {
|
||||
query_result += col + " ASC, ";
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *QueryBuilder::desc(const String &col) {
|
||||
query_result += col + " DESC, ";
|
||||
if (col == "") {
|
||||
query_result += "DESC, ";
|
||||
} else {
|
||||
query_result += col + " DESC, ";
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
@ -317,31 +298,93 @@ QueryBuilder::~QueryBuilder() {
|
||||
}
|
||||
|
||||
void QueryBuilder::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("next_row"), &QueryResult::next_row);
|
||||
ClassDB::bind_method(D_METHOD("cvalues"), &QueryBuilder::_cvalues_bind);
|
||||
ClassDB::bind_method(D_METHOD("next_value"), &QueryBuilder::_next_value_bind);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("begin_transaction"), &QueryBuilder::_begin_transaction_bind);
|
||||
ClassDB::bind_method(D_METHOD("commit"), &QueryBuilder::_commit_bind);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("nl"), &QueryBuilder::_nl_bind);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("str"), &QueryBuilder::_str_bind);
|
||||
ClassDB::bind_method(D_METHOD("cstr"), &QueryBuilder::_cstr_bind);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("select", "params"), &QueryBuilder::_select_bind, "");
|
||||
ClassDB::bind_method(D_METHOD("update", "params"), &QueryBuilder::_update_bind, "");
|
||||
ClassDB::bind_method(D_METHOD("del", "params"), &QueryBuilder::_del_bind, "");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("where", "params"), &QueryBuilder::_where_bind, "");
|
||||
ClassDB::bind_method(D_METHOD("from", "params"), &QueryBuilder::_from_bind, "");
|
||||
ClassDB::bind_method(D_METHOD("insert", "table_name", "colums"), &QueryBuilder::_insert_bind, "", "");
|
||||
ClassDB::bind_method(D_METHOD("values", "params_str"), &QueryBuilder::_values_bind, "");
|
||||
ClassDB::bind_method(D_METHOD("val"), &QueryBuilder::_val_bind);
|
||||
ClassDB::bind_method(D_METHOD("vals", "param"), &QueryBuilder::_vals_bind);
|
||||
ClassDB::bind_method(D_METHOD("vali", "param"), &QueryBuilder::_vali_bind);
|
||||
ClassDB::bind_method(D_METHOD("valb", "param"), &QueryBuilder::_valb_bind);
|
||||
ClassDB::bind_method(D_METHOD("valf", "param"), &QueryBuilder::_valf_bind);
|
||||
ClassDB::bind_method(D_METHOD("vald", "param"), &QueryBuilder::_vald_bind);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("like", "str"), &QueryBuilder::_like_bind, "");
|
||||
ClassDB::bind_method(D_METHOD("sets"), &QueryBuilder::_sets_bind);
|
||||
ClassDB::bind_method(D_METHOD("cset"), &QueryBuilder::_cset_bind);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("setps", "col", "param"), &QueryBuilder::_setps_bind);
|
||||
ClassDB::bind_method(D_METHOD("setpi", "col", "param"), &QueryBuilder::_setpi_bind);
|
||||
ClassDB::bind_method(D_METHOD("setpb", "col", "param"), &QueryBuilder::_setpb_bind);
|
||||
ClassDB::bind_method(D_METHOD("setpf", "col", "param"), &QueryBuilder::_setpf_bind);
|
||||
ClassDB::bind_method(D_METHOD("setpd", "col", "param"), &QueryBuilder::_setpd_bind);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("wps", "col", "param"), &QueryBuilder::_wps_bind);
|
||||
ClassDB::bind_method(D_METHOD("wpi", "col", "param"), &QueryBuilder::_wpi_bind);
|
||||
ClassDB::bind_method(D_METHOD("wpb", "col", "param"), &QueryBuilder::_wpb_bind);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("nselect", "params"), &QueryBuilder::_nselect_bind);
|
||||
ClassDB::bind_method(D_METHOD("nupdate", "params"), &QueryBuilder::_nupdate_bind);
|
||||
ClassDB::bind_method(D_METHOD("ndel", "params"), &QueryBuilder::_ndel_bind);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("nwhere", "params"), &QueryBuilder::_nwhere_bind);
|
||||
ClassDB::bind_method(D_METHOD("nfrom", "params"), &QueryBuilder::_nfrom_bind);
|
||||
ClassDB::bind_method(D_METHOD("nlike", "str"), &QueryBuilder::_nlike_bind);
|
||||
ClassDB::bind_method(D_METHOD("nvalues", "params_str"), &QueryBuilder::_nvalues_bind);
|
||||
ClassDB::bind_method(D_METHOD("nval", "param"), &QueryBuilder::_nval_bind);
|
||||
ClassDB::bind_method(D_METHOD("nsetp", "col", "escape_param"), &QueryBuilder::_nsetp_bind);
|
||||
ClassDB::bind_method(D_METHOD("nwp", "col", "escape_param"), &QueryBuilder::_nwp_bind);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("limit", "num"), &QueryBuilder::_limit_bind);
|
||||
ClassDB::bind_method(D_METHOD("offset", "num"), &QueryBuilder::_offset_bind);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("order_by_asc", "col"), &QueryBuilder::_order_by_asc_bind);
|
||||
ClassDB::bind_method(D_METHOD("order_by_desc", "col"), &QueryBuilder::_order_by_desc_bind);
|
||||
ClassDB::bind_method(D_METHOD("order_by", "col"), &QueryBuilder::_order_by_bind);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("order_by"), &QueryBuilder::_order_by_bind);
|
||||
ClassDB::bind_method(D_METHOD("corder_by"), &QueryBuilder::_corder_by_bind);
|
||||
ClassDB::bind_method(D_METHOD("order_by_add_col", "col"), &QueryBuilder::_order_by_add_col_bind);
|
||||
ClassDB::bind_method(D_METHOD("asc", "col"), &QueryBuilder::_asc_bind, "");
|
||||
ClassDB::bind_method(D_METHOD("desc", "col"), &QueryBuilder::_desc_bind, "");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("land"), &QueryBuilder::_land_bind);
|
||||
ClassDB::bind_method(D_METHOD("lor"), &QueryBuilder::_lor_bind);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("wildcard"), &QueryBuilder::_wildcard_bind);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("w", "str"), &QueryBuilder::_w_bind);
|
||||
ClassDB::bind_method(D_METHOD("ew", "str"), &QueryBuilder::_ew_bind);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("select_last_insert_id"), &QueryBuilder::_select_last_insert_id_bind);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("escape", "param"), &QueryBuilder::_escape_bind);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("prepare"), &QueryBuilder::_prepare_bind);
|
||||
ClassDB::bind_method(D_METHOD("set_params", "index", "value"), &QueryBuilder::_set_params_bind);
|
||||
ClassDB::bind_method(D_METHOD("set_parami", "index", "value"), &QueryBuilder::_set_parami_bind);
|
||||
ClassDB::bind_method(D_METHOD("set_paramf", "index", "value"), &QueryBuilder::_set_paramf_bind);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("end_command"), &QueryBuilder::_end_command_bind);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("reset"), &QueryBuilder::_reset_bind);
|
||||
}
|
||||
|
||||
Ref<QueryBuilder> QueryBuilder::_select_bind() {
|
||||
return Ref<QueryBuilder>(select());
|
||||
}
|
||||
Ref<QueryBuilder> QueryBuilder::_update_bind() {
|
||||
return Ref<QueryBuilder>(update());
|
||||
}
|
||||
Ref<QueryBuilder> QueryBuilder::_del_bind() {
|
||||
return Ref<QueryBuilder>(del());
|
||||
}
|
||||
|
||||
Ref<QueryBuilder> QueryBuilder::_where_bind() {
|
||||
return Ref<QueryBuilder>(where());
|
||||
}
|
||||
Ref<QueryBuilder> QueryBuilder::_from_bind() {
|
||||
return Ref<QueryBuilder>(from());
|
||||
}
|
||||
Ref<QueryBuilder> QueryBuilder::_insert_bind() {
|
||||
return Ref<QueryBuilder>(insert());
|
||||
}
|
||||
Ref<QueryBuilder> QueryBuilder::_values_bind() {
|
||||
return Ref<QueryBuilder>(values());
|
||||
}
|
||||
Ref<QueryBuilder> QueryBuilder::_cvalues_bind() {
|
||||
return Ref<QueryBuilder>(cvalues());
|
||||
}
|
||||
@ -367,10 +410,6 @@ Ref<QueryBuilder> QueryBuilder::_cstr_bind() {
|
||||
return Ref<QueryBuilder>(cstr());
|
||||
}
|
||||
|
||||
Ref<QueryBuilder> QueryBuilder::_like_bind() {
|
||||
return Ref<QueryBuilder>(like());
|
||||
}
|
||||
|
||||
Ref<QueryBuilder> QueryBuilder::_select_bind(const String ¶ms) {
|
||||
return Ref<QueryBuilder>(select());
|
||||
}
|
||||
@ -416,8 +455,8 @@ Ref<QueryBuilder> QueryBuilder::_like_bind(const String &str) {
|
||||
return Ref<QueryBuilder>(like());
|
||||
}
|
||||
|
||||
Ref<QueryBuilder> QueryBuilder::_set_bind() {
|
||||
return Ref<QueryBuilder>(set());
|
||||
Ref<QueryBuilder> QueryBuilder::_sets_bind() {
|
||||
return Ref<QueryBuilder>(sets());
|
||||
}
|
||||
Ref<QueryBuilder> QueryBuilder::_cset_bind() {
|
||||
return Ref<QueryBuilder>(cset());
|
||||
@ -500,18 +539,9 @@ Ref<QueryBuilder> QueryBuilder::_order_by_bind(const String &col) {
|
||||
return Ref<QueryBuilder>(order_by(col));
|
||||
}
|
||||
|
||||
Ref<QueryBuilder> QueryBuilder::_order_by_bind() {
|
||||
return Ref<QueryBuilder>(order_by());
|
||||
}
|
||||
Ref<QueryBuilder> QueryBuilder::_corder_by_bind() {
|
||||
return Ref<QueryBuilder>(corder_by());
|
||||
}
|
||||
Ref<QueryBuilder> QueryBuilder::_asc_bind() {
|
||||
return Ref<QueryBuilder>(asc());
|
||||
}
|
||||
Ref<QueryBuilder> QueryBuilder::_desc_bind() {
|
||||
return Ref<QueryBuilder>(desc());
|
||||
}
|
||||
Ref<QueryBuilder> QueryBuilder::_order_by_add_col_bind(const String &col) {
|
||||
return Ref<QueryBuilder>(order_by_add_col(col));
|
||||
}
|
||||
|
@ -17,10 +17,6 @@ public:
|
||||
virtual QueryBuilder *update();
|
||||
virtual QueryBuilder *del();
|
||||
|
||||
virtual QueryBuilder *where();
|
||||
virtual QueryBuilder *from();
|
||||
virtual QueryBuilder *insert();
|
||||
virtual QueryBuilder *values();
|
||||
virtual QueryBuilder *cvalues();
|
||||
virtual QueryBuilder *next_value();
|
||||
|
||||
@ -32,16 +28,14 @@ public:
|
||||
virtual QueryBuilder *str();
|
||||
virtual QueryBuilder *cstr();
|
||||
|
||||
virtual QueryBuilder *like();
|
||||
|
||||
virtual QueryBuilder *select(const String ¶ms);
|
||||
virtual QueryBuilder *update(const String ¶ms);
|
||||
virtual QueryBuilder *del(const String ¶ms);
|
||||
|
||||
virtual QueryBuilder *where(const String ¶ms);
|
||||
virtual QueryBuilder *from(const String ¶ms);
|
||||
virtual QueryBuilder *insert(const String &table_name, const String &columns = "");
|
||||
virtual QueryBuilder *values(const String ¶ms_str);
|
||||
virtual QueryBuilder *where(const String ¶ms = "");
|
||||
virtual QueryBuilder *from(const String ¶ms = "");
|
||||
virtual QueryBuilder *insert(const String &table_name = "", const String &columns = "");
|
||||
virtual QueryBuilder *values(const String ¶ms_str = "");
|
||||
virtual QueryBuilder *val();
|
||||
virtual QueryBuilder *vals(const String ¶m);
|
||||
virtual QueryBuilder *vals(const char *param);
|
||||
@ -50,9 +44,10 @@ public:
|
||||
virtual QueryBuilder *valf(const float param);
|
||||
virtual QueryBuilder *vald(const double param);
|
||||
|
||||
virtual QueryBuilder *like(const String &str);
|
||||
virtual QueryBuilder *like(const String &str = "");
|
||||
|
||||
virtual QueryBuilder *set();
|
||||
//Object Already has set(), so think of it as set_sql
|
||||
virtual QueryBuilder *sets();
|
||||
virtual QueryBuilder *cset();
|
||||
|
||||
virtual QueryBuilder *setps(const String &col, const String ¶m);
|
||||
@ -86,15 +81,12 @@ public:
|
||||
|
||||
virtual QueryBuilder *order_by_asc(const String &col);
|
||||
virtual QueryBuilder *order_by_desc(const String &col);
|
||||
virtual QueryBuilder *order_by(const String &col);
|
||||
virtual QueryBuilder *order_by(const String &col = "");
|
||||
|
||||
virtual QueryBuilder *order_by();
|
||||
virtual QueryBuilder *corder_by();
|
||||
virtual QueryBuilder *asc();
|
||||
virtual QueryBuilder *desc();
|
||||
virtual QueryBuilder *order_by_add_col(const String &col);
|
||||
virtual QueryBuilder *asc(const String &col);
|
||||
virtual QueryBuilder *desc(const String &col);
|
||||
virtual QueryBuilder *asc(const String &col = "");
|
||||
virtual QueryBuilder *desc(const String &col = "");
|
||||
|
||||
//l=logical (and, or are operators)
|
||||
virtual QueryBuilder *land();
|
||||
@ -133,14 +125,6 @@ public:
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
Ref<QueryBuilder> _select_bind();
|
||||
Ref<QueryBuilder> _update_bind();
|
||||
Ref<QueryBuilder> _del_bind();
|
||||
|
||||
Ref<QueryBuilder> _where_bind();
|
||||
Ref<QueryBuilder> _from_bind();
|
||||
Ref<QueryBuilder> _insert_bind();
|
||||
Ref<QueryBuilder> _values_bind();
|
||||
Ref<QueryBuilder> _cvalues_bind();
|
||||
Ref<QueryBuilder> _next_value_bind();
|
||||
|
||||
@ -152,16 +136,14 @@ protected:
|
||||
Ref<QueryBuilder> _str_bind();
|
||||
Ref<QueryBuilder> _cstr_bind();
|
||||
|
||||
Ref<QueryBuilder> _like_bind();
|
||||
|
||||
Ref<QueryBuilder> _select_bind(const String ¶ms);
|
||||
Ref<QueryBuilder> _update_bind(const String ¶ms);
|
||||
Ref<QueryBuilder> _del_bind(const String ¶ms);
|
||||
|
||||
Ref<QueryBuilder> _where_bind(const String ¶ms);
|
||||
Ref<QueryBuilder> _from_bind(const String ¶ms);
|
||||
Ref<QueryBuilder> _insert_bind(const String &table_name, const String &columns = "");
|
||||
Ref<QueryBuilder> _values_bind(const String ¶ms_str);
|
||||
Ref<QueryBuilder> _where_bind(const String ¶ms = "");
|
||||
Ref<QueryBuilder> _from_bind(const String ¶ms = "");
|
||||
Ref<QueryBuilder> _insert_bind(const String &table_name = "", const String &columns = "");
|
||||
Ref<QueryBuilder> _values_bind(const String ¶ms_str = "");
|
||||
Ref<QueryBuilder> _val_bind();
|
||||
Ref<QueryBuilder> _vals_bind(const String ¶m);
|
||||
Ref<QueryBuilder> _vali_bind(const int param);
|
||||
@ -171,7 +153,7 @@ protected:
|
||||
|
||||
Ref<QueryBuilder> _like_bind(const String &str);
|
||||
|
||||
Ref<QueryBuilder> _set_bind();
|
||||
Ref<QueryBuilder> _sets_bind();
|
||||
Ref<QueryBuilder> _cset_bind();
|
||||
|
||||
Ref<QueryBuilder> _setps_bind(const String &col, const String ¶m);
|
||||
@ -203,15 +185,12 @@ protected:
|
||||
|
||||
Ref<QueryBuilder> _order_by_asc_bind(const String &col);
|
||||
Ref<QueryBuilder> _order_by_desc_bind(const String &col);
|
||||
Ref<QueryBuilder> _order_by_bind(const String &col);
|
||||
Ref<QueryBuilder> _order_by_bind(const String &col = "");
|
||||
|
||||
Ref<QueryBuilder> _order_by_bind();
|
||||
Ref<QueryBuilder> _corder_by_bind();
|
||||
Ref<QueryBuilder> _asc_bind();
|
||||
Ref<QueryBuilder> _desc_bind();
|
||||
Ref<QueryBuilder> _order_by_add_col_bind(const String &col);
|
||||
Ref<QueryBuilder> _asc_bind(const String &col);
|
||||
Ref<QueryBuilder> _desc_bind(const String &col);
|
||||
Ref<QueryBuilder> _asc_bind(const String &col = "");
|
||||
Ref<QueryBuilder> _desc_bind(const String &col = "");
|
||||
|
||||
//l=logical (and, or are operators)
|
||||
Ref<QueryBuilder> _land_bind();
|
||||
|
Loading…
Reference in New Issue
Block a user