mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-22 11:56:49 +01:00
Added more helper methods to deal with prepared statements to QueryBuilder.
This commit is contained in:
parent
ef3aa03887
commit
2cb6e3d97f
@ -106,28 +106,33 @@ QueryBuilder *QueryBuilder::values(const String ¶ms_str) {
|
||||
QueryBuilder *QueryBuilder::val() {
|
||||
return this;
|
||||
}
|
||||
|
||||
QueryBuilder *QueryBuilder::vals(const String ¶m) {
|
||||
return nval(escape(param));
|
||||
}
|
||||
|
||||
QueryBuilder *QueryBuilder::vals(const char *param) {
|
||||
return this;
|
||||
}
|
||||
|
||||
QueryBuilder *QueryBuilder::vali(const int param) {
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *QueryBuilder::valb(const bool param) {
|
||||
return this;
|
||||
}
|
||||
|
||||
QueryBuilder *QueryBuilder::valf(const float param) {
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *QueryBuilder::vald(const double param) {
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *QueryBuilder::valph() {
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *QueryBuilder::valphi(const String &p_id) {
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *QueryBuilder::valphr(const String &p_raw_id) {
|
||||
return this;
|
||||
}
|
||||
|
||||
QueryBuilder *QueryBuilder::like(const String &str) {
|
||||
return nlike(escape(str));
|
||||
@ -157,6 +162,15 @@ QueryBuilder *QueryBuilder::setpf(const String &col, const float param) {
|
||||
QueryBuilder *QueryBuilder::setpd(const String &col, const double param) {
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *QueryBuilder::setph(const String &col) {
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *QueryBuilder::setphi(const String &col, const String &p_id) {
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *QueryBuilder::setphr(const String &col, const String &p_raw_id) {
|
||||
return this;
|
||||
}
|
||||
|
||||
QueryBuilder *QueryBuilder::wps(const String &col, const String ¶m) {
|
||||
return nwp(col, escape(param));
|
||||
@ -170,6 +184,15 @@ QueryBuilder *QueryBuilder::wpi(const String &col, const int param) {
|
||||
QueryBuilder *QueryBuilder::wpb(const String &col, const bool param) {
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *QueryBuilder::wph(const String &col) {
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *QueryBuilder::wphi(const String &col, const String &p_id) {
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *QueryBuilder::wphr(const String &col, const String &p_raw_id) {
|
||||
return this;
|
||||
}
|
||||
|
||||
QueryBuilder *QueryBuilder::nselect(const String ¶ms) {
|
||||
return this;
|
||||
@ -370,6 +393,9 @@ void QueryBuilder::_bind_methods() {
|
||||
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("valph"), &QueryBuilder::_valph_bind);
|
||||
ClassDB::bind_method(D_METHOD("valphi", "id"), &QueryBuilder::_valphi_bind);
|
||||
ClassDB::bind_method(D_METHOD("valphr", "raw_id"), &QueryBuilder::_valphr_bind);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("like", "str"), &QueryBuilder::_like_bind, "");
|
||||
ClassDB::bind_method(D_METHOD("sets"), &QueryBuilder::_sets_bind);
|
||||
@ -380,10 +406,16 @@ void QueryBuilder::_bind_methods() {
|
||||
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("setph", "col"), &QueryBuilder::_setph_bind);
|
||||
ClassDB::bind_method(D_METHOD("setphi", "col", "id"), &QueryBuilder::_setphi_bind);
|
||||
ClassDB::bind_method(D_METHOD("setphr", "col", "raw_id"), &QueryBuilder::_setphr_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("wph", "col"), &QueryBuilder::_wph_bind);
|
||||
ClassDB::bind_method(D_METHOD("wphi", "col", "id"), &QueryBuilder::_wphi_bind);
|
||||
ClassDB::bind_method(D_METHOD("wphr", "col", "raw_id"), &QueryBuilder::_wphr_bind);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("nselect", "params"), &QueryBuilder::_nselect_bind);
|
||||
ClassDB::bind_method(D_METHOD("nupdate", "params"), &QueryBuilder::_nupdate_bind);
|
||||
@ -500,6 +532,15 @@ Ref<QueryBuilder> QueryBuilder::_valf_bind(const float param) {
|
||||
Ref<QueryBuilder> QueryBuilder::_vald_bind(const double param) {
|
||||
return Ref<QueryBuilder>(vald(param));
|
||||
}
|
||||
Ref<QueryBuilder> QueryBuilder::_valph_bind() {
|
||||
return Ref<QueryBuilder>(valph());
|
||||
}
|
||||
Ref<QueryBuilder> QueryBuilder::_valphi_bind(const String &p_id) {
|
||||
return Ref<QueryBuilder>(valphi(p_id));
|
||||
}
|
||||
Ref<QueryBuilder> QueryBuilder::_valphr_bind(const String &p_raw_id) {
|
||||
return Ref<QueryBuilder>(valphr(p_raw_id));
|
||||
}
|
||||
|
||||
Ref<QueryBuilder> QueryBuilder::_like_bind(const String &str) {
|
||||
return Ref<QueryBuilder>(like(str));
|
||||
@ -527,6 +568,15 @@ Ref<QueryBuilder> QueryBuilder::_setpf_bind(const String &col, const float param
|
||||
Ref<QueryBuilder> QueryBuilder::_setpd_bind(const String &col, const double param) {
|
||||
return Ref<QueryBuilder>(setpd(col, param));
|
||||
}
|
||||
Ref<QueryBuilder> QueryBuilder::_setph_bind(const String &col) {
|
||||
return Ref<QueryBuilder>(setph(col));
|
||||
}
|
||||
Ref<QueryBuilder> QueryBuilder::_setphi_bind(const String &col, const String &p_id) {
|
||||
return Ref<QueryBuilder>(setphi(col, p_id));
|
||||
}
|
||||
Ref<QueryBuilder> QueryBuilder::_setphr_bind(const String &col, const String &p_raw_id) {
|
||||
return Ref<QueryBuilder>(setphr(col, p_raw_id));
|
||||
}
|
||||
|
||||
Ref<QueryBuilder> QueryBuilder::_wps_bind(const String &col, const String ¶m) {
|
||||
return Ref<QueryBuilder>(wps(col, param));
|
||||
@ -537,6 +587,15 @@ Ref<QueryBuilder> QueryBuilder::_wpi_bind(const String &col, const int param) {
|
||||
Ref<QueryBuilder> QueryBuilder::_wpb_bind(const String &col, const bool param) {
|
||||
return Ref<QueryBuilder>(wpb(col, param));
|
||||
}
|
||||
Ref<QueryBuilder> QueryBuilder::_wph_bind(const String &col) {
|
||||
return Ref<QueryBuilder>(wph(col));
|
||||
}
|
||||
Ref<QueryBuilder> QueryBuilder::_wphi_bind(const String &col, const String &p_id) {
|
||||
return Ref<QueryBuilder>(wphi(col, p_id));
|
||||
}
|
||||
Ref<QueryBuilder> QueryBuilder::_wphr_bind(const String &col, const String &p_raw_id) {
|
||||
return Ref<QueryBuilder>(wphr(col, p_raw_id));
|
||||
}
|
||||
|
||||
Ref<QueryBuilder> QueryBuilder::_nselect_bind(const String ¶ms) {
|
||||
return Ref<QueryBuilder>(nselect(params));
|
||||
|
@ -32,8 +32,8 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "core/string/ustring.h"
|
||||
#include "core/string/string_builder.h"
|
||||
#include "core/string/ustring.h"
|
||||
|
||||
#include "core/object/reference.h"
|
||||
|
||||
@ -79,6 +79,9 @@ public:
|
||||
virtual QueryBuilder *valb(const bool param);
|
||||
virtual QueryBuilder *valf(const float param);
|
||||
virtual QueryBuilder *vald(const double param);
|
||||
virtual QueryBuilder *valph();
|
||||
virtual QueryBuilder *valphi(const String &p_id);
|
||||
virtual QueryBuilder *valphr(const String &p_raw_id);
|
||||
|
||||
virtual QueryBuilder *like(const String &str = "");
|
||||
|
||||
@ -92,11 +95,18 @@ public:
|
||||
virtual QueryBuilder *setpb(const String &col, const bool param);
|
||||
virtual QueryBuilder *setpf(const String &col, const float param);
|
||||
virtual QueryBuilder *setpd(const String &col, const double param);
|
||||
virtual QueryBuilder *setph(const String &col);
|
||||
virtual QueryBuilder *setphi(const String &col, const String &p_id);
|
||||
virtual QueryBuilder *setphr(const String &col, const String &p_raw_id);
|
||||
|
||||
// Where param helpers
|
||||
virtual QueryBuilder *wps(const String &col, const String ¶m);
|
||||
virtual QueryBuilder *wps(const String &col, const char *param);
|
||||
virtual QueryBuilder *wpi(const String &col, const int param);
|
||||
virtual QueryBuilder *wpb(const String &col, const bool param);
|
||||
virtual QueryBuilder *wph(const String &col);
|
||||
virtual QueryBuilder *wphi(const String &col, const String &p_id);
|
||||
virtual QueryBuilder *wphr(const String &col, const String &p_raw_id);
|
||||
|
||||
virtual QueryBuilder *nselect(const String ¶ms);
|
||||
virtual QueryBuilder *nupdate(const String ¶ms);
|
||||
@ -184,6 +194,9 @@ protected:
|
||||
Ref<QueryBuilder> _valb_bind(const bool param);
|
||||
Ref<QueryBuilder> _valf_bind(const float param);
|
||||
Ref<QueryBuilder> _vald_bind(const double param);
|
||||
Ref<QueryBuilder> _valph_bind();
|
||||
Ref<QueryBuilder> _valphi_bind(const String &p_id);
|
||||
Ref<QueryBuilder> _valphr_bind(const String &p_raw_id);
|
||||
|
||||
Ref<QueryBuilder> _like_bind(const String &str);
|
||||
|
||||
@ -195,10 +208,16 @@ protected:
|
||||
Ref<QueryBuilder> _setpb_bind(const String &col, const bool param);
|
||||
Ref<QueryBuilder> _setpf_bind(const String &col, const float param);
|
||||
Ref<QueryBuilder> _setpd_bind(const String &col, const double param);
|
||||
Ref<QueryBuilder> _setph_bind(const String &col);
|
||||
Ref<QueryBuilder> _setphi_bind(const String &col, const String &p_id);
|
||||
Ref<QueryBuilder> _setphr_bind(const String &col, const String &p_raw_id);
|
||||
|
||||
Ref<QueryBuilder> _wps_bind(const String &col, const String ¶m);
|
||||
Ref<QueryBuilder> _wpi_bind(const String &col, const int param);
|
||||
Ref<QueryBuilder> _wpb_bind(const String &col, const bool param);
|
||||
Ref<QueryBuilder> _wph_bind(const String &col);
|
||||
Ref<QueryBuilder> _wphi_bind(const String &col, const String &p_id);
|
||||
Ref<QueryBuilder> _wphr_bind(const String &col, const String &p_raw_id);
|
||||
|
||||
Ref<QueryBuilder> _nselect_bind(const String ¶ms);
|
||||
Ref<QueryBuilder> _nupdate_bind(const String ¶ms);
|
||||
|
@ -208,6 +208,24 @@ QueryBuilder *SQLite3QueryBuilder::vald(const double param) {
|
||||
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *SQLite3QueryBuilder::valph() {
|
||||
psph();
|
||||
query_result += ", ";
|
||||
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *SQLite3QueryBuilder::valphi(const String &p_id) {
|
||||
psphi(p_id);
|
||||
query_result += ", ";
|
||||
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *SQLite3QueryBuilder::valphr(const String &p_raw_id) {
|
||||
psphi(p_raw_id);
|
||||
query_result += ", ";
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
QueryBuilder *SQLite3QueryBuilder::nlike(const String &str) {
|
||||
query_result += "LIKE '";
|
||||
@ -285,6 +303,30 @@ QueryBuilder *SQLite3QueryBuilder::setpd(const String &col, const double param)
|
||||
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *SQLite3QueryBuilder::setph(const String &col) {
|
||||
query_result += col;
|
||||
query_result += "=";
|
||||
psph();
|
||||
query_result += ", ";
|
||||
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *SQLite3QueryBuilder::setphi(const String &col, const String &p_id) {
|
||||
query_result += col;
|
||||
query_result += "=";
|
||||
psphi(p_id);
|
||||
query_result += ", ";
|
||||
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *SQLite3QueryBuilder::setphr(const String &col, const String &p_raw_id) {
|
||||
query_result += col;
|
||||
query_result += "=";
|
||||
psphr(p_raw_id);
|
||||
query_result += ", ";
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
QueryBuilder *SQLite3QueryBuilder::nwp(const String &col, const String ¶m) {
|
||||
query_result += col;
|
||||
@ -321,6 +363,30 @@ QueryBuilder *SQLite3QueryBuilder::wpb(const String &col, const bool param) {
|
||||
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *SQLite3QueryBuilder::wph(const String &col) {
|
||||
query_result += col;
|
||||
query_result += "='";
|
||||
psph();
|
||||
query_result += "' ";
|
||||
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *SQLite3QueryBuilder::wphi(const String &col, const String &p_id) {
|
||||
query_result += col;
|
||||
query_result += "='";
|
||||
psphi(p_id);
|
||||
query_result += "' ";
|
||||
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *SQLite3QueryBuilder::wphr(const String &col, const String &p_raw_id) {
|
||||
query_result += col;
|
||||
query_result += "='";
|
||||
psphr(p_raw_id);
|
||||
query_result += "' ";
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
QueryBuilder *SQLite3QueryBuilder::limit(const int num) {
|
||||
query_result += "LIMIT ";
|
||||
|
@ -44,6 +44,9 @@ public:
|
||||
QueryBuilder *valb(const bool param);
|
||||
QueryBuilder *valf(const float param);
|
||||
QueryBuilder *vald(const double param);
|
||||
virtual QueryBuilder *valph();
|
||||
virtual QueryBuilder *valphi(const String &p_id);
|
||||
virtual QueryBuilder *valphr(const String &p_raw_id);
|
||||
|
||||
QueryBuilder *nlike(const String &str);
|
||||
|
||||
@ -57,12 +60,18 @@ public:
|
||||
QueryBuilder *setpb(const String &col, const bool param);
|
||||
QueryBuilder *setpf(const String &col, const float param);
|
||||
QueryBuilder *setpd(const String &col, const double param);
|
||||
virtual QueryBuilder *setph(const String &col);
|
||||
virtual QueryBuilder *setphi(const String &col, const String &p_id);
|
||||
virtual QueryBuilder *setphr(const String &col, const String &p_raw_id);
|
||||
|
||||
QueryBuilder *nwp(const String &col, const String ¶m);
|
||||
|
||||
QueryBuilder *wps(const String &col, const char *param);
|
||||
QueryBuilder *wpi(const String &col, const int param);
|
||||
QueryBuilder *wpb(const String &col, const bool param);
|
||||
virtual QueryBuilder *wph(const String &col);
|
||||
virtual QueryBuilder *wphi(const String &col, const String &p_id);
|
||||
virtual QueryBuilder *wphr(const String &col, const String &p_raw_id);
|
||||
|
||||
QueryBuilder *limit(const int num);
|
||||
QueryBuilder *offset(const int num);
|
||||
|
Loading…
Reference in New Issue
Block a user