mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2024-11-14 04:57:21 +01:00
Added more things to QueryBuilder.
This commit is contained in:
parent
d2cff831bd
commit
928475d733
@ -29,6 +29,17 @@ QueryBuilder *QueryBuilder::cvalues() {
|
||||
return this;
|
||||
}
|
||||
|
||||
QueryBuilder *QueryBuilder::str() {
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *QueryBuilder::cstr() {
|
||||
return this;
|
||||
}
|
||||
|
||||
QueryBuilder *QueryBuilder::like() {
|
||||
return this;
|
||||
}
|
||||
|
||||
QueryBuilder *QueryBuilder::select(const std::string ¶ms) {
|
||||
return this;
|
||||
}
|
||||
@ -75,6 +86,10 @@ QueryBuilder *QueryBuilder::val(const bool param) {
|
||||
return this;
|
||||
}
|
||||
|
||||
QueryBuilder *QueryBuilder::like(const std::string &str) {
|
||||
return this;
|
||||
}
|
||||
|
||||
QueryBuilder *QueryBuilder::set() {
|
||||
return this;
|
||||
}
|
||||
@ -128,6 +143,9 @@ QueryBuilder *QueryBuilder::einsert(const std::string &table_name) {
|
||||
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *QueryBuilder::elike(const std::string &str) {
|
||||
return like(escape(str));
|
||||
}
|
||||
QueryBuilder *QueryBuilder::evalues(const std::string ¶ms_str) {
|
||||
return values(escape(params_str));
|
||||
}
|
||||
@ -158,6 +176,10 @@ QueryBuilder *QueryBuilder::lor() {
|
||||
return this;
|
||||
}
|
||||
|
||||
QueryBuilder *QueryBuilder::wildcard() {
|
||||
return this;
|
||||
}
|
||||
|
||||
QueryBuilder *QueryBuilder::w(const std::string &str) {
|
||||
query_result += str + " ";
|
||||
|
||||
|
@ -21,6 +21,11 @@ public:
|
||||
virtual QueryBuilder *values();
|
||||
virtual QueryBuilder *cvalues();
|
||||
|
||||
virtual QueryBuilder *str();
|
||||
virtual QueryBuilder *cstr();
|
||||
|
||||
virtual QueryBuilder *like();
|
||||
|
||||
virtual QueryBuilder *select(const std::string ¶ms);
|
||||
virtual QueryBuilder *udpate(const std::string ¶ms);
|
||||
virtual QueryBuilder *del(const std::string ¶ms);
|
||||
@ -36,6 +41,8 @@ public:
|
||||
virtual QueryBuilder *val(const int param);
|
||||
virtual QueryBuilder *val(const bool param);
|
||||
|
||||
virtual QueryBuilder *like(const std::string &str);
|
||||
|
||||
virtual QueryBuilder *set();
|
||||
virtual QueryBuilder *cset();
|
||||
|
||||
@ -56,6 +63,7 @@ public:
|
||||
virtual QueryBuilder *ewhere(const std::string ¶ms);
|
||||
virtual QueryBuilder *efrom(const std::string ¶ms);
|
||||
virtual QueryBuilder *einsert(const std::string &table_name);
|
||||
virtual QueryBuilder *elike(const std::string &str);
|
||||
virtual QueryBuilder *evalues(const std::string ¶ms_str);
|
||||
virtual QueryBuilder *eval(const std::string ¶m);
|
||||
//note col is NOT escaped
|
||||
@ -70,6 +78,8 @@ public:
|
||||
virtual QueryBuilder *land();
|
||||
virtual QueryBuilder *lor();
|
||||
|
||||
virtual QueryBuilder *wildcard();
|
||||
|
||||
virtual QueryBuilder *w(const std::string &str);
|
||||
virtual QueryBuilder *ew(const std::string &str);
|
||||
|
||||
|
@ -48,6 +48,23 @@ QueryBuilder *SQLite3QueryBuilder::cvalues() {
|
||||
return this;
|
||||
}
|
||||
|
||||
QueryBuilder *SQLite3QueryBuilder::str() {
|
||||
query_result += "'";
|
||||
|
||||
return this;
|
||||
}
|
||||
QueryBuilder *SQLite3QueryBuilder::cstr() {
|
||||
query_result += "'";
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
QueryBuilder *SQLite3QueryBuilder::like() {
|
||||
query_result += "LIKE ";
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
QueryBuilder *SQLite3QueryBuilder::select(const std::string ¶ms) {
|
||||
query_result += "SELECT " + params + " ";
|
||||
|
||||
@ -128,6 +145,12 @@ QueryBuilder *SQLite3QueryBuilder::val(const bool param) {
|
||||
return this;
|
||||
}
|
||||
|
||||
QueryBuilder *SQLite3QueryBuilder::like(const std::string &str) {
|
||||
query_result += "LIKE '" + str + "' ";
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
QueryBuilder *SQLite3QueryBuilder::set() {
|
||||
query_result += "SET ";
|
||||
|
||||
@ -225,6 +248,12 @@ QueryBuilder *SQLite3QueryBuilder::lor() {
|
||||
return this;
|
||||
}
|
||||
|
||||
QueryBuilder *SQLite3QueryBuilder::wildcard() {
|
||||
query_result += "%";
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
std::string SQLite3QueryBuilder::escape(const std::string ¶ms) {
|
||||
if (!_db) {
|
||||
printf("SQLite3QueryBuilder::escape !db!\n");
|
||||
|
@ -20,6 +20,11 @@ public:
|
||||
QueryBuilder *values();
|
||||
QueryBuilder *cvalues();
|
||||
|
||||
QueryBuilder *str();
|
||||
QueryBuilder *cstr();
|
||||
|
||||
QueryBuilder *like();
|
||||
|
||||
QueryBuilder *select(const std::string ¶ms);
|
||||
QueryBuilder *udpate(const std::string ¶ms);
|
||||
QueryBuilder *del(const std::string ¶ms);
|
||||
@ -35,6 +40,8 @@ public:
|
||||
QueryBuilder *val(const int param);
|
||||
QueryBuilder *val(const bool param);
|
||||
|
||||
QueryBuilder *like(const std::string &str);
|
||||
|
||||
QueryBuilder *set();
|
||||
QueryBuilder *cset();
|
||||
QueryBuilder *setp(const std::string &col, const std::string ¶m);
|
||||
@ -51,8 +58,10 @@ public:
|
||||
QueryBuilder *offset(const int num);
|
||||
|
||||
//l=logical (and, or are operators)
|
||||
virtual QueryBuilder *land();
|
||||
virtual QueryBuilder *lor();
|
||||
QueryBuilder *land();
|
||||
QueryBuilder *lor();
|
||||
|
||||
QueryBuilder *wildcard();
|
||||
|
||||
QueryBuilder *select_last_insert_id();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user