mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2024-11-14 04:57:21 +01:00
Now QueryBuilder is using my string.
This commit is contained in:
parent
cfb5f877c8
commit
faac12d3b1
@ -40,30 +40,30 @@ QueryBuilder *QueryBuilder::like() {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder *QueryBuilder::select(const std::string ¶ms) {
|
QueryBuilder *QueryBuilder::select(const String ¶ms) {
|
||||||
return nselect(escape(params));
|
return nselect(escape(params));
|
||||||
}
|
}
|
||||||
QueryBuilder *QueryBuilder::update(const std::string ¶ms) {
|
QueryBuilder *QueryBuilder::update(const String ¶ms) {
|
||||||
return nupdate(escape(params));
|
return nupdate(escape(params));
|
||||||
}
|
}
|
||||||
QueryBuilder *QueryBuilder::del(const std::string ¶ms) {
|
QueryBuilder *QueryBuilder::del(const String ¶ms) {
|
||||||
return ndel(escape(params));
|
return ndel(escape(params));
|
||||||
}
|
}
|
||||||
QueryBuilder *QueryBuilder::where(const std::string ¶ms) {
|
QueryBuilder *QueryBuilder::where(const String ¶ms) {
|
||||||
return nwhere(escape(params));
|
return nwhere(escape(params));
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder *QueryBuilder::from(const std::string ¶ms) {
|
QueryBuilder *QueryBuilder::from(const String ¶ms) {
|
||||||
return nfrom(escape(params));
|
return nfrom(escape(params));
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder *QueryBuilder::insert(const std::string &table_name) {
|
QueryBuilder *QueryBuilder::insert(const String &table_name) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
QueryBuilder *QueryBuilder::insert(const std::string &table_name, const std::string &columns) {
|
QueryBuilder *QueryBuilder::insert(const String &table_name, const String &columns) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
QueryBuilder *QueryBuilder::values(const std::string ¶ms_str) {
|
QueryBuilder *QueryBuilder::values(const String ¶ms_str) {
|
||||||
return nvalues(escape(params_str));
|
return nvalues(escape(params_str));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ QueryBuilder *QueryBuilder::val() {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder *QueryBuilder::val(const std::string ¶m) {
|
QueryBuilder *QueryBuilder::val(const String ¶m) {
|
||||||
return nval(escape(param));
|
return nval(escape(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ QueryBuilder *QueryBuilder::val(const bool param) {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder *QueryBuilder::like(const std::string &str) {
|
QueryBuilder *QueryBuilder::like(const String &str) {
|
||||||
return nlike(escape(str));
|
return nlike(escape(str));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,63 +96,63 @@ QueryBuilder *QueryBuilder::set() {
|
|||||||
QueryBuilder *QueryBuilder::cset() {
|
QueryBuilder *QueryBuilder::cset() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
QueryBuilder *QueryBuilder::setp(const std::string &col, const std::string ¶m) {
|
QueryBuilder *QueryBuilder::setp(const String &col, const String ¶m) {
|
||||||
return nsetp(col, escape(param));
|
return nsetp(col, escape(param));
|
||||||
}
|
}
|
||||||
QueryBuilder *QueryBuilder::setp(const std::string &col, const char *param) {
|
QueryBuilder *QueryBuilder::setp(const String &col, const char *param) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
QueryBuilder *QueryBuilder::setp(const std::string &col, const int param) {
|
QueryBuilder *QueryBuilder::setp(const String &col, const int param) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
QueryBuilder *QueryBuilder::setp(const std::string &col, const bool param) {
|
QueryBuilder *QueryBuilder::setp(const String &col, const bool param) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder *QueryBuilder::wp(const std::string &col, const std::string ¶m) {
|
QueryBuilder *QueryBuilder::wp(const String &col, const String ¶m) {
|
||||||
return nwp(col, escape(param));
|
return nwp(col, escape(param));
|
||||||
}
|
}
|
||||||
QueryBuilder *QueryBuilder::wp(const std::string &col, const char *param) {
|
QueryBuilder *QueryBuilder::wp(const String &col, const char *param) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
QueryBuilder *QueryBuilder::wp(const std::string &col, const int param) {
|
QueryBuilder *QueryBuilder::wp(const String &col, const int param) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
QueryBuilder *QueryBuilder::wp(const std::string &col, const bool param) {
|
QueryBuilder *QueryBuilder::wp(const String &col, const bool param) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder *QueryBuilder::nselect(const std::string ¶ms) {
|
QueryBuilder *QueryBuilder::nselect(const String ¶ms) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
QueryBuilder *QueryBuilder::nupdate(const std::string ¶ms) {
|
QueryBuilder *QueryBuilder::nupdate(const String ¶ms) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
QueryBuilder *QueryBuilder::ndel(const std::string ¶ms) {
|
QueryBuilder *QueryBuilder::ndel(const String ¶ms) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder *QueryBuilder::nwhere(const std::string ¶ms) {
|
QueryBuilder *QueryBuilder::nwhere(const String ¶ms) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
QueryBuilder *QueryBuilder::nfrom(const std::string ¶ms) {
|
QueryBuilder *QueryBuilder::nfrom(const String ¶ms) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
QueryBuilder *QueryBuilder::nlike(const std::string &str) {
|
QueryBuilder *QueryBuilder::nlike(const String &str) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
QueryBuilder *QueryBuilder::nvalues(const std::string ¶ms_str) {
|
QueryBuilder *QueryBuilder::nvalues(const String ¶ms_str) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder *QueryBuilder::nval(const std::string ¶m) {
|
QueryBuilder *QueryBuilder::nval(const String ¶m) {
|
||||||
return val(escape(param));
|
return val(escape(param));
|
||||||
}
|
}
|
||||||
QueryBuilder *QueryBuilder::nsetp(const std::string &col, const std::string &escape_param) {
|
QueryBuilder *QueryBuilder::nsetp(const String &col, const String &escape_param) {
|
||||||
return setp(col, escape(escape_param));
|
return setp(col, escape(escape_param));
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder *QueryBuilder::nwp(const std::string &col, const std::string &escape_param) {
|
QueryBuilder *QueryBuilder::nwp(const String &col, const String &escape_param) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,12 +175,12 @@ QueryBuilder *QueryBuilder::wildcard() {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder *QueryBuilder::w(const std::string &str) {
|
QueryBuilder *QueryBuilder::w(const String &str) {
|
||||||
query_result += str + " ";
|
query_result += str + " ";
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
QueryBuilder *QueryBuilder::ew(const std::string &str) {
|
QueryBuilder *QueryBuilder::ew(const String &str) {
|
||||||
return w(escape(str));
|
return w(escape(str));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,14 +188,14 @@ QueryBuilder *QueryBuilder::select_last_insert_id() {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string QueryBuilder::escape(const std::string ¶ms) {
|
String QueryBuilder::escape(const String ¶ms) {
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder *QueryBuilder::prepare() {
|
QueryBuilder *QueryBuilder::prepare() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
QueryBuilder *QueryBuilder::set_param(const int index, const std::string &value) {
|
QueryBuilder *QueryBuilder::set_param(const int index, const String &value) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
QueryBuilder *QueryBuilder::set_param(const int index, const int value) {
|
QueryBuilder *QueryBuilder::set_param(const int index, const int value) {
|
||||||
@ -221,7 +221,7 @@ Ref<QueryResult> QueryBuilder::run() {
|
|||||||
void QueryBuilder::run_query() {
|
void QueryBuilder::run_query() {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string QueryBuilder::get_result() {
|
String QueryBuilder::get_result() {
|
||||||
end_command();
|
end_command();
|
||||||
|
|
||||||
return query_result;
|
return query_result;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef QUERY_BUILDER_H
|
#ifndef QUERY_BUILDER_H
|
||||||
#define QUERY_BUILDER_H
|
#define QUERY_BUILDER_H
|
||||||
|
|
||||||
#include <string>
|
#include "core/string.h"
|
||||||
|
|
||||||
#include "core/reference.h"
|
#include "core/reference.h"
|
||||||
|
|
||||||
@ -26,49 +26,49 @@ public:
|
|||||||
|
|
||||||
virtual QueryBuilder *like();
|
virtual QueryBuilder *like();
|
||||||
|
|
||||||
virtual QueryBuilder *select(const std::string ¶ms);
|
virtual QueryBuilder *select(const String ¶ms);
|
||||||
virtual QueryBuilder *update(const std::string ¶ms);
|
virtual QueryBuilder *update(const String ¶ms);
|
||||||
virtual QueryBuilder *del(const std::string ¶ms);
|
virtual QueryBuilder *del(const String ¶ms);
|
||||||
|
|
||||||
virtual QueryBuilder *where(const std::string ¶ms);
|
virtual QueryBuilder *where(const String ¶ms);
|
||||||
virtual QueryBuilder *from(const std::string ¶ms);
|
virtual QueryBuilder *from(const String ¶ms);
|
||||||
virtual QueryBuilder *insert(const std::string &table_name);
|
virtual QueryBuilder *insert(const String &table_name);
|
||||||
virtual QueryBuilder *insert(const std::string &table_name, const std::string &columns);
|
virtual QueryBuilder *insert(const String &table_name, const String &columns);
|
||||||
virtual QueryBuilder *values(const std::string ¶ms_str);
|
virtual QueryBuilder *values(const String ¶ms_str);
|
||||||
virtual QueryBuilder *val();
|
virtual QueryBuilder *val();
|
||||||
virtual QueryBuilder *val(const std::string ¶m);
|
virtual QueryBuilder *val(const String ¶m);
|
||||||
virtual QueryBuilder *val(const char *param);
|
virtual QueryBuilder *val(const char *param);
|
||||||
virtual QueryBuilder *val(const int param);
|
virtual QueryBuilder *val(const int param);
|
||||||
virtual QueryBuilder *val(const bool param);
|
virtual QueryBuilder *val(const bool param);
|
||||||
|
|
||||||
virtual QueryBuilder *like(const std::string &str);
|
virtual QueryBuilder *like(const String &str);
|
||||||
|
|
||||||
virtual QueryBuilder *set();
|
virtual QueryBuilder *set();
|
||||||
virtual QueryBuilder *cset();
|
virtual QueryBuilder *cset();
|
||||||
|
|
||||||
virtual QueryBuilder *setp(const std::string &col, const std::string ¶m);
|
virtual QueryBuilder *setp(const String &col, const String ¶m);
|
||||||
virtual QueryBuilder *setp(const std::string &col, const char *param);
|
virtual QueryBuilder *setp(const String &col, const char *param);
|
||||||
virtual QueryBuilder *setp(const std::string &col, const int param);
|
virtual QueryBuilder *setp(const String &col, const int param);
|
||||||
virtual QueryBuilder *setp(const std::string &col, const bool param);
|
virtual QueryBuilder *setp(const String &col, const bool param);
|
||||||
|
|
||||||
virtual QueryBuilder *wp(const std::string &col, const std::string ¶m);
|
virtual QueryBuilder *wp(const String &col, const String ¶m);
|
||||||
virtual QueryBuilder *wp(const std::string &col, const char *param);
|
virtual QueryBuilder *wp(const String &col, const char *param);
|
||||||
virtual QueryBuilder *wp(const std::string &col, const int param);
|
virtual QueryBuilder *wp(const String &col, const int param);
|
||||||
virtual QueryBuilder *wp(const std::string &col, const bool param);
|
virtual QueryBuilder *wp(const String &col, const bool param);
|
||||||
|
|
||||||
virtual QueryBuilder *nselect(const std::string ¶ms);
|
virtual QueryBuilder *nselect(const String ¶ms);
|
||||||
virtual QueryBuilder *nupdate(const std::string ¶ms);
|
virtual QueryBuilder *nupdate(const String ¶ms);
|
||||||
virtual QueryBuilder *ndel(const std::string ¶ms);
|
virtual QueryBuilder *ndel(const String ¶ms);
|
||||||
|
|
||||||
virtual QueryBuilder *nwhere(const std::string ¶ms);
|
virtual QueryBuilder *nwhere(const String ¶ms);
|
||||||
virtual QueryBuilder *nfrom(const std::string ¶ms);
|
virtual QueryBuilder *nfrom(const String ¶ms);
|
||||||
virtual QueryBuilder *nlike(const std::string &str);
|
virtual QueryBuilder *nlike(const String &str);
|
||||||
virtual QueryBuilder *nvalues(const std::string ¶ms_str);
|
virtual QueryBuilder *nvalues(const String ¶ms_str);
|
||||||
virtual QueryBuilder *nval(const std::string ¶m);
|
virtual QueryBuilder *nval(const String ¶m);
|
||||||
//note col is NOT escaped
|
//note col is NOT escaped
|
||||||
virtual QueryBuilder *nsetp(const std::string &col, const std::string &escape_param);
|
virtual QueryBuilder *nsetp(const String &col, const String &escape_param);
|
||||||
//note col is NOT escaped
|
//note col is NOT escaped
|
||||||
virtual QueryBuilder *nwp(const std::string &col, const std::string &escape_param);
|
virtual QueryBuilder *nwp(const String &col, const String &escape_param);
|
||||||
|
|
||||||
virtual QueryBuilder *limit(const int num);
|
virtual QueryBuilder *limit(const int num);
|
||||||
virtual QueryBuilder *offset(const int num);
|
virtual QueryBuilder *offset(const int num);
|
||||||
@ -79,15 +79,15 @@ public:
|
|||||||
|
|
||||||
virtual QueryBuilder *wildcard();
|
virtual QueryBuilder *wildcard();
|
||||||
|
|
||||||
virtual QueryBuilder *w(const std::string &str);
|
virtual QueryBuilder *w(const String &str);
|
||||||
virtual QueryBuilder *ew(const std::string &str);
|
virtual QueryBuilder *ew(const String &str);
|
||||||
|
|
||||||
virtual QueryBuilder *select_last_insert_id();
|
virtual QueryBuilder *select_last_insert_id();
|
||||||
|
|
||||||
virtual std::string escape(const std::string ¶ms);
|
virtual String escape(const String ¶ms);
|
||||||
|
|
||||||
virtual QueryBuilder *prepare();
|
virtual QueryBuilder *prepare();
|
||||||
virtual QueryBuilder *set_param(const int index, const std::string &value);
|
virtual QueryBuilder *set_param(const int index, const String &value);
|
||||||
virtual QueryBuilder *set_param(const int index, const int value);
|
virtual QueryBuilder *set_param(const int index, const int value);
|
||||||
virtual QueryBuilder *set_param(const int index, const float value);
|
virtual QueryBuilder *set_param(const int index, const float value);
|
||||||
|
|
||||||
@ -98,14 +98,14 @@ public:
|
|||||||
virtual Ref<QueryResult> run();
|
virtual Ref<QueryResult> run();
|
||||||
virtual void run_query();
|
virtual void run_query();
|
||||||
|
|
||||||
std::string get_result();
|
String get_result();
|
||||||
|
|
||||||
void print();
|
void print();
|
||||||
|
|
||||||
QueryBuilder();
|
QueryBuilder();
|
||||||
virtual ~QueryBuilder();
|
virtual ~QueryBuilder();
|
||||||
|
|
||||||
std::string query_result;
|
String query_result;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -461,7 +461,7 @@ const char String::operator[](const int index) const {
|
|||||||
return _data[index];
|
return _data[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
char String::operator[](const int index) {
|
char &String::operator[](const int index) {
|
||||||
return _data[index];
|
return _data[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -624,6 +624,14 @@ String& String::operator=(const std::string &other) {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String& String::operator=(const char* other) {
|
||||||
|
clear();
|
||||||
|
|
||||||
|
append_str(other);
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
String::String() {
|
String::String() {
|
||||||
_data = nullptr;
|
_data = nullptr;
|
||||||
_actual_size = 0;
|
_actual_size = 0;
|
||||||
|
@ -68,7 +68,7 @@ public:
|
|||||||
const char *data() const;
|
const char *data() const;
|
||||||
|
|
||||||
const char operator[](const int index) const;
|
const char operator[](const int index) const;
|
||||||
char operator[](const int index);
|
char &operator[](const int index);
|
||||||
|
|
||||||
String &operator+=(const String &b);
|
String &operator+=(const String &b);
|
||||||
String &operator+=(const char chr);
|
String &operator+=(const char chr);
|
||||||
@ -100,6 +100,7 @@ public:
|
|||||||
|
|
||||||
String& operator=(const String &other);
|
String& operator=(const String &other);
|
||||||
String& operator=(const std::string &other);
|
String& operator=(const std::string &other);
|
||||||
|
String& operator=(const char* other);
|
||||||
|
|
||||||
String();
|
String();
|
||||||
String(const String &other);
|
String(const String &other);
|
||||||
|
@ -34,37 +34,37 @@ QueryBuilder *MysqlQueryBuilder::cvalues() {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder *MysqlQueryBuilder::nselect(const std::string ¶ms) {
|
QueryBuilder *MysqlQueryBuilder::nselect(const String ¶ms) {
|
||||||
query_result += "SELECT " + params + " ";
|
query_result += "SELECT " + params + " ";
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder *MysqlQueryBuilder::nwhere(const std::string ¶ms) {
|
QueryBuilder *MysqlQueryBuilder::nwhere(const String ¶ms) {
|
||||||
query_result += "WHERE " + params + " ";
|
query_result += "WHERE " + params + " ";
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder *MysqlQueryBuilder::nfrom(const std::string ¶ms) {
|
QueryBuilder *MysqlQueryBuilder::nfrom(const String ¶ms) {
|
||||||
query_result += "FROM " + params + " ";
|
query_result += "FROM " + params + " ";
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder *MysqlQueryBuilder::ninsert(const std::string &table_name) {
|
QueryBuilder *MysqlQueryBuilder::ninsert(const String &table_name) {
|
||||||
query_result += "INSERT INTO " + table_name + " ";
|
query_result += "INSERT INTO " + table_name + " ";
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder *MysqlQueryBuilder::nvalues(const std::string ¶ms_str) {
|
QueryBuilder *MysqlQueryBuilder::nvalues(const String ¶ms_str) {
|
||||||
query_result += "VALUES(" + params_str + ") ";
|
query_result += "VALUES(" + params_str + ") ";
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string MysqlQueryBuilder::escape(const std::string ¶ms) {
|
String MysqlQueryBuilder::escape(const String ¶ms) {
|
||||||
if (!_db) {
|
if (!_db) {
|
||||||
printf("MysqlQueryBuilder::escape !db!\n");
|
printf("MysqlQueryBuilder::escape !db!\n");
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ QueryBuilder *MysqlQueryBuilder::prepare() {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder *MysqlQueryBuilder::set_param(const int index, const std::string &value) {
|
QueryBuilder *MysqlQueryBuilder::set_param(const int index, const String &value) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
QueryBuilder *MysqlQueryBuilder::set_param(const int index, const int value) {
|
QueryBuilder *MysqlQueryBuilder::set_param(const int index, const int value) {
|
||||||
|
@ -18,19 +18,19 @@ public:
|
|||||||
QueryBuilder *values();
|
QueryBuilder *values();
|
||||||
QueryBuilder *cvalues();
|
QueryBuilder *cvalues();
|
||||||
|
|
||||||
QueryBuilder *nselect(const std::string ¶ms);
|
QueryBuilder *nselect(const String ¶ms);
|
||||||
QueryBuilder *nwhere(const std::string ¶ms);
|
QueryBuilder *nwhere(const String ¶ms);
|
||||||
QueryBuilder *nfrom(const std::string ¶ms);
|
QueryBuilder *nfrom(const String ¶ms);
|
||||||
QueryBuilder *ninsert(const std::string &table_name);
|
QueryBuilder *ninsert(const String &table_name);
|
||||||
QueryBuilder *nvalues(const std::string ¶ms_str);
|
QueryBuilder *nvalues(const String ¶ms_str);
|
||||||
|
|
||||||
QueryBuilder *limit(const int num);
|
QueryBuilder *limit(const int num);
|
||||||
QueryBuilder *offset(const int num);
|
QueryBuilder *offset(const int num);
|
||||||
|
|
||||||
std::string escape(const std::string ¶ms);
|
String escape(const String ¶ms);
|
||||||
|
|
||||||
QueryBuilder *prepare();
|
QueryBuilder *prepare();
|
||||||
QueryBuilder *set_param(const int index, const std::string &value);
|
QueryBuilder *set_param(const int index, const String &value);
|
||||||
QueryBuilder *set_param(const int index, const int value);
|
QueryBuilder *set_param(const int index, const int value);
|
||||||
QueryBuilder *set_param(const int index, const float value);
|
QueryBuilder *set_param(const int index, const float value);
|
||||||
|
|
||||||
|
@ -65,45 +65,45 @@ QueryBuilder *SQLite3QueryBuilder::like() {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder *SQLite3QueryBuilder::nselect(const std::string ¶ms) {
|
QueryBuilder *SQLite3QueryBuilder::nselect(const String ¶ms) {
|
||||||
query_result += "SELECT " + params + " ";
|
query_result += "SELECT " + params + " ";
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
QueryBuilder *SQLite3QueryBuilder::nupdate(const std::string ¶ms) {
|
QueryBuilder *SQLite3QueryBuilder::nupdate(const String ¶ms) {
|
||||||
query_result += "UPDATE " + params + " ";
|
query_result += "UPDATE " + params + " ";
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
QueryBuilder *SQLite3QueryBuilder::ndel(const std::string ¶ms) {
|
QueryBuilder *SQLite3QueryBuilder::ndel(const String ¶ms) {
|
||||||
query_result += "DELETE FROM " + params + " ";
|
query_result += "DELETE FROM " + params + " ";
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder *SQLite3QueryBuilder::nwhere(const std::string ¶ms) {
|
QueryBuilder *SQLite3QueryBuilder::nwhere(const String ¶ms) {
|
||||||
query_result += "WHERE " + params + " ";
|
query_result += "WHERE " + params + " ";
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder *SQLite3QueryBuilder::nfrom(const std::string ¶ms) {
|
QueryBuilder *SQLite3QueryBuilder::nfrom(const String ¶ms) {
|
||||||
query_result += "FROM " + params + " ";
|
query_result += "FROM " + params + " ";
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder *SQLite3QueryBuilder::insert(const std::string &table_name) {
|
QueryBuilder *SQLite3QueryBuilder::insert(const String &table_name) {
|
||||||
query_result += "INSERT INTO " + table_name + " ";
|
query_result += "INSERT INTO " + table_name + " ";
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
QueryBuilder *SQLite3QueryBuilder::insert(const std::string &table_name, const std::string &columns) {
|
QueryBuilder *SQLite3QueryBuilder::insert(const String &table_name, const String &columns) {
|
||||||
query_result += "INSERT INTO " + table_name + "(" + columns + ") ";
|
query_result += "INSERT INTO " + table_name + "(" + columns + ") ";
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
QueryBuilder *SQLite3QueryBuilder::nvalues(const std::string ¶ms_str) {
|
QueryBuilder *SQLite3QueryBuilder::nvalues(const String ¶ms_str) {
|
||||||
query_result += "VALUES(" + params_str + ") ";
|
query_result += "VALUES(" + params_str + ") ";
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
@ -115,14 +115,14 @@ QueryBuilder *SQLite3QueryBuilder::val() {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder *SQLite3QueryBuilder::nval(const std::string ¶m) {
|
QueryBuilder *SQLite3QueryBuilder::nval(const String ¶m) {
|
||||||
query_result += "'" + param + "', ";
|
query_result += "'" + param + "', ";
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder *SQLite3QueryBuilder::val(const char *param) {
|
QueryBuilder *SQLite3QueryBuilder::val(const char *param) {
|
||||||
query_result += "'" + std::string(param) + "', ";
|
query_result += "'" + String(param) + "', ";
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -145,7 +145,7 @@ QueryBuilder *SQLite3QueryBuilder::val(const bool param) {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder *SQLite3QueryBuilder::nlike(const std::string &str) {
|
QueryBuilder *SQLite3QueryBuilder::nlike(const String &str) {
|
||||||
query_result += "LIKE '" + str + "' ";
|
query_result += "LIKE '" + str + "' ";
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
@ -161,17 +161,17 @@ QueryBuilder *SQLite3QueryBuilder::cset() {
|
|||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
QueryBuilder *SQLite3QueryBuilder::nsetp(const std::string &col, const std::string ¶m) {
|
QueryBuilder *SQLite3QueryBuilder::nsetp(const String &col, const String ¶m) {
|
||||||
query_result += col + "='" + param + "', ";
|
query_result += col + "='" + param + "', ";
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
QueryBuilder *SQLite3QueryBuilder::setp(const std::string &col, const char *param) {
|
QueryBuilder *SQLite3QueryBuilder::setp(const String &col, const char *param) {
|
||||||
query_result += col + "='" + std::string(param) + "', ";
|
query_result += col + "='" + String(param) + "', ";
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
QueryBuilder *SQLite3QueryBuilder::setp(const std::string &col, const int param) {
|
QueryBuilder *SQLite3QueryBuilder::setp(const String &col, const int param) {
|
||||||
//todo add a better way
|
//todo add a better way
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << param;
|
ss << param;
|
||||||
@ -180,7 +180,7 @@ QueryBuilder *SQLite3QueryBuilder::setp(const std::string &col, const int param)
|
|||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
QueryBuilder *SQLite3QueryBuilder::setp(const std::string &col, const bool param) {
|
QueryBuilder *SQLite3QueryBuilder::setp(const String &col, const bool param) {
|
||||||
if (param)
|
if (param)
|
||||||
query_result += col + "=1, ";
|
query_result += col + "=1, ";
|
||||||
else
|
else
|
||||||
@ -189,17 +189,17 @@ QueryBuilder *SQLite3QueryBuilder::setp(const std::string &col, const bool param
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder *SQLite3QueryBuilder::nwp(const std::string &col, const std::string ¶m) {
|
QueryBuilder *SQLite3QueryBuilder::nwp(const String &col, const String ¶m) {
|
||||||
query_result += col + "='" + param + "' ";
|
query_result += col + "='" + param + "' ";
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
QueryBuilder *SQLite3QueryBuilder::wp(const std::string &col, const char *param) {
|
QueryBuilder *SQLite3QueryBuilder::wp(const String &col, const char *param) {
|
||||||
query_result += col + "='" + std::string(param) + "' ";
|
query_result += col + "='" + String(param) + "' ";
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
QueryBuilder *SQLite3QueryBuilder::wp(const std::string &col, const int param) {
|
QueryBuilder *SQLite3QueryBuilder::wp(const String &col, const int param) {
|
||||||
//todo add a better way
|
//todo add a better way
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << param;
|
ss << param;
|
||||||
@ -208,7 +208,7 @@ QueryBuilder *SQLite3QueryBuilder::wp(const std::string &col, const int param) {
|
|||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
QueryBuilder *SQLite3QueryBuilder::wp(const std::string &col, const bool param) {
|
QueryBuilder *SQLite3QueryBuilder::wp(const String &col, const bool param) {
|
||||||
if (param)
|
if (param)
|
||||||
query_result += col + "=1 ";
|
query_result += col + "=1 ";
|
||||||
else
|
else
|
||||||
@ -254,7 +254,7 @@ QueryBuilder *SQLite3QueryBuilder::wildcard() {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string SQLite3QueryBuilder::escape(const std::string ¶ms) {
|
String SQLite3QueryBuilder::escape(const String ¶ms) {
|
||||||
if (!_db) {
|
if (!_db) {
|
||||||
printf("SQLite3QueryBuilder::escape !db!\n");
|
printf("SQLite3QueryBuilder::escape !db!\n");
|
||||||
|
|
||||||
@ -268,7 +268,7 @@ QueryBuilder *SQLite3QueryBuilder::prepare() {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder *SQLite3QueryBuilder::set_param(const int index, const std::string &value) {
|
QueryBuilder *SQLite3QueryBuilder::set_param(const int index, const String &value) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
QueryBuilder *SQLite3QueryBuilder::set_param(const int index, const int value) {
|
QueryBuilder *SQLite3QueryBuilder::set_param(const int index, const int value) {
|
||||||
|
@ -25,34 +25,34 @@ public:
|
|||||||
|
|
||||||
QueryBuilder *like();
|
QueryBuilder *like();
|
||||||
|
|
||||||
QueryBuilder *nselect(const std::string ¶ms);
|
QueryBuilder *nselect(const String ¶ms);
|
||||||
QueryBuilder *nupdate(const std::string ¶ms);
|
QueryBuilder *nupdate(const String ¶ms);
|
||||||
QueryBuilder *ndel(const std::string ¶ms);
|
QueryBuilder *ndel(const String ¶ms);
|
||||||
|
|
||||||
QueryBuilder *nwhere(const std::string ¶ms);
|
QueryBuilder *nwhere(const String ¶ms);
|
||||||
QueryBuilder *nfrom(const std::string ¶ms);
|
QueryBuilder *nfrom(const String ¶ms);
|
||||||
QueryBuilder *insert(const std::string &table_name);
|
QueryBuilder *insert(const String &table_name);
|
||||||
QueryBuilder *insert(const std::string &table_name, const std::string &columns);
|
QueryBuilder *insert(const String &table_name, const String &columns);
|
||||||
QueryBuilder *nvalues(const std::string ¶ms_str);
|
QueryBuilder *nvalues(const String ¶ms_str);
|
||||||
QueryBuilder *val();
|
QueryBuilder *val();
|
||||||
QueryBuilder *nval(const std::string ¶m);
|
QueryBuilder *nval(const String ¶m);
|
||||||
QueryBuilder *val(const char *param);
|
QueryBuilder *val(const char *param);
|
||||||
QueryBuilder *val(const int param);
|
QueryBuilder *val(const int param);
|
||||||
QueryBuilder *val(const bool param);
|
QueryBuilder *val(const bool param);
|
||||||
|
|
||||||
QueryBuilder *nlike(const std::string &str);
|
QueryBuilder *nlike(const String &str);
|
||||||
|
|
||||||
QueryBuilder *set();
|
QueryBuilder *set();
|
||||||
QueryBuilder *cset();
|
QueryBuilder *cset();
|
||||||
QueryBuilder *nsetp(const std::string &col, const std::string ¶m);
|
QueryBuilder *nsetp(const String &col, const String ¶m);
|
||||||
QueryBuilder *setp(const std::string &col, const char *param);
|
QueryBuilder *setp(const String &col, const char *param);
|
||||||
QueryBuilder *setp(const std::string &col, const int param);
|
QueryBuilder *setp(const String &col, const int param);
|
||||||
QueryBuilder *setp(const std::string &col, const bool param);
|
QueryBuilder *setp(const String &col, const bool param);
|
||||||
|
|
||||||
QueryBuilder *nwp(const std::string &col, const std::string ¶m);
|
QueryBuilder *nwp(const String &col, const String ¶m);
|
||||||
QueryBuilder *wp(const std::string &col, const char *param);
|
QueryBuilder *wp(const String &col, const char *param);
|
||||||
QueryBuilder *wp(const std::string &col, const int param);
|
QueryBuilder *wp(const String &col, const int param);
|
||||||
QueryBuilder *wp(const std::string &col, const bool param);
|
QueryBuilder *wp(const String &col, const bool param);
|
||||||
|
|
||||||
QueryBuilder *limit(const int num);
|
QueryBuilder *limit(const int num);
|
||||||
QueryBuilder *offset(const int num);
|
QueryBuilder *offset(const int num);
|
||||||
@ -65,10 +65,10 @@ public:
|
|||||||
|
|
||||||
QueryBuilder *select_last_insert_id();
|
QueryBuilder *select_last_insert_id();
|
||||||
|
|
||||||
std::string escape(const std::string ¶ms);
|
String escape(const String ¶ms);
|
||||||
|
|
||||||
QueryBuilder *prepare();
|
QueryBuilder *prepare();
|
||||||
QueryBuilder *set_param(const int index, const std::string &value);
|
QueryBuilder *set_param(const int index, const String &value);
|
||||||
QueryBuilder *set_param(const int index, const int value);
|
QueryBuilder *set_param(const int index, const int value);
|
||||||
QueryBuilder *set_param(const int index, const float value);
|
QueryBuilder *set_param(const int index, const float value);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user