mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2025-05-06 17:51:36 +02:00
Added and and or to the query builder, and implemented offset and limit for the sqlite query builder.
This commit is contained in:
parent
af9979d9a7
commit
4228448fc1
@ -151,6 +151,13 @@ QueryBuilder *QueryBuilder::offset(const int num) {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QueryBuilder *QueryBuilder::land() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
QueryBuilder *QueryBuilder::lor() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
QueryBuilder *QueryBuilder::w(const std::string &str) {
|
QueryBuilder *QueryBuilder::w(const std::string &str) {
|
||||||
query_result += str + " ";
|
query_result += str + " ";
|
||||||
|
|
||||||
|
@ -64,6 +64,10 @@ public:
|
|||||||
virtual QueryBuilder *limit(const int num);
|
virtual QueryBuilder *limit(const int num);
|
||||||
virtual QueryBuilder *offset(const int num);
|
virtual QueryBuilder *offset(const int num);
|
||||||
|
|
||||||
|
//l=logical (and, or are operators)
|
||||||
|
virtual QueryBuilder *land();
|
||||||
|
virtual QueryBuilder *lor();
|
||||||
|
|
||||||
virtual QueryBuilder *w(const std::string &str);
|
virtual QueryBuilder *w(const std::string &str);
|
||||||
virtual QueryBuilder *ew(const std::string &str);
|
virtual QueryBuilder *ew(const std::string &str);
|
||||||
|
|
||||||
|
@ -195,13 +195,32 @@ QueryBuilder *SQLite3QueryBuilder::wp(const std::string &col, const bool param)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder *SQLite3QueryBuilder::limit(const int num) {
|
QueryBuilder *SQLite3QueryBuilder::limit(const int num) {
|
||||||
//query_result += "LIMIT " + num + " ";
|
//todo better way
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << num;
|
||||||
|
|
||||||
|
query_result += "LIMIT " + ss.str() + " ";
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder *SQLite3QueryBuilder::offset(const int num) {
|
QueryBuilder *SQLite3QueryBuilder::offset(const int num) {
|
||||||
//query_result += "OFFSET " + num + " ";
|
//todo better way
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << num;
|
||||||
|
|
||||||
|
query_result += "OFFSET " + ss.str() + " ";
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
QueryBuilder *SQLite3QueryBuilder::land() {
|
||||||
|
query_result += "AND ";
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
QueryBuilder *SQLite3QueryBuilder::lor() {
|
||||||
|
query_result += "OR ";
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,10 @@ public:
|
|||||||
QueryBuilder *limit(const int num);
|
QueryBuilder *limit(const int num);
|
||||||
QueryBuilder *offset(const int num);
|
QueryBuilder *offset(const int num);
|
||||||
|
|
||||||
|
//l=logical (and, or are operators)
|
||||||
|
virtual QueryBuilder *land();
|
||||||
|
virtual QueryBuilder *lor();
|
||||||
|
|
||||||
QueryBuilder *select_last_insert_id();
|
QueryBuilder *select_last_insert_id();
|
||||||
|
|
||||||
std::string escape(const std::string ¶ms);
|
std::string escape(const std::string ¶ms);
|
||||||
|
Loading…
Reference in New Issue
Block a user