rcpp_framework/database/query_builder.cpp

320 lines
6.4 KiB
C++
Raw Normal View History

#include "query_builder.h"
#include "query_result.h"
QueryBuilder *QueryBuilder::select() {
return this;
}
2021-11-01 17:00:55 +01:00
QueryBuilder *QueryBuilder::update() {
return this;
}
2021-08-20 12:49:57 +02:00
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;
}
2021-11-14 19:22:49 +01:00
QueryBuilder *QueryBuilder::next_value() {
return this;
}
QueryBuilder *QueryBuilder::begin_transaction() {
return this;
}
QueryBuilder *QueryBuilder::commit() {
return this;
}
QueryBuilder *QueryBuilder::nl() {
query_result += "\n";
return this;
}
2021-08-22 21:44:20 +02:00
QueryBuilder *QueryBuilder::str() {
return this;
}
QueryBuilder *QueryBuilder::cstr() {
return this;
}
QueryBuilder *QueryBuilder::like() {
return this;
}
2021-11-01 17:31:04 +01:00
QueryBuilder *QueryBuilder::select(const String &params) {
return nselect(escape(params));
}
2021-11-01 17:31:04 +01:00
QueryBuilder *QueryBuilder::update(const String &params) {
return nupdate(escape(params));
}
2021-11-01 17:31:04 +01:00
QueryBuilder *QueryBuilder::del(const String &params) {
return ndel(escape(params));
2021-08-20 12:49:57 +02:00
}
2021-11-01 17:31:04 +01:00
QueryBuilder *QueryBuilder::where(const String &params) {
return nwhere(escape(params));
}
2021-11-01 17:31:04 +01:00
QueryBuilder *QueryBuilder::from(const String &params) {
return nfrom(escape(params));
}
2021-11-01 17:31:04 +01:00
QueryBuilder *QueryBuilder::insert(const String &table_name) {
return this;
}
2021-11-01 17:31:04 +01:00
QueryBuilder *QueryBuilder::insert(const String &table_name, const String &columns) {
return this;
}
2021-11-01 17:31:04 +01:00
QueryBuilder *QueryBuilder::values(const String &params_str) {
return nvalues(escape(params_str));
}
QueryBuilder *QueryBuilder::val() {
return this;
}
2021-11-01 17:31:04 +01:00
QueryBuilder *QueryBuilder::val(const String &param) {
return nval(escape(param));
}
QueryBuilder *QueryBuilder::val(const char *param) {
return this;
}
QueryBuilder *QueryBuilder::val(const int param) {
return this;
}
QueryBuilder *QueryBuilder::val(const bool param) {
return this;
}
QueryBuilder *QueryBuilder::valf(const float param) {
return this;
}
QueryBuilder *QueryBuilder::vald(const double param) {
return this;
}
2021-11-01 17:31:04 +01:00
QueryBuilder *QueryBuilder::like(const String &str) {
return nlike(escape(str));
2021-08-22 21:44:20 +02:00
}
QueryBuilder *QueryBuilder::set() {
return this;
}
QueryBuilder *QueryBuilder::cset() {
return this;
}
2021-11-01 17:31:04 +01:00
QueryBuilder *QueryBuilder::setp(const String &col, const String &param) {
return nsetp(col, escape(param));
}
2021-11-01 17:31:04 +01:00
QueryBuilder *QueryBuilder::setp(const String &col, const char *param) {
return this;
}
2021-11-01 17:31:04 +01:00
QueryBuilder *QueryBuilder::setp(const String &col, const int param) {
return this;
}
2021-11-01 17:31:04 +01:00
QueryBuilder *QueryBuilder::setp(const String &col, const bool param) {
return this;
}
QueryBuilder *QueryBuilder::setpf(const String &col, const float param) {
return this;
}
QueryBuilder *QueryBuilder::setpd(const String &col, const double param) {
return this;
}
2021-11-01 17:31:04 +01:00
QueryBuilder *QueryBuilder::wp(const String &col, const String &param) {
return nwp(col, escape(param));
}
2021-11-01 17:31:04 +01:00
QueryBuilder *QueryBuilder::wp(const String &col, const char *param) {
return this;
}
2021-11-01 17:31:04 +01:00
QueryBuilder *QueryBuilder::wp(const String &col, const int param) {
return this;
}
2021-11-01 17:31:04 +01:00
QueryBuilder *QueryBuilder::wp(const String &col, const bool param) {
return this;
}
2021-08-20 12:49:57 +02:00
2021-11-01 17:31:04 +01:00
QueryBuilder *QueryBuilder::nselect(const String &params) {
return this;
2021-08-20 12:49:57 +02:00
}
2021-11-01 17:31:04 +01:00
QueryBuilder *QueryBuilder::nupdate(const String &params) {
return this;
2021-08-20 12:49:57 +02:00
}
2021-11-01 17:31:04 +01:00
QueryBuilder *QueryBuilder::ndel(const String &params) {
return this;
2021-08-20 12:49:57 +02:00
}
2021-11-01 17:31:04 +01:00
QueryBuilder *QueryBuilder::nwhere(const String &params) {
return this;
2021-08-20 12:49:57 +02:00
}
2021-11-01 17:31:04 +01:00
QueryBuilder *QueryBuilder::nfrom(const String &params) {
return this;
}
2021-11-01 17:31:04 +01:00
QueryBuilder *QueryBuilder::nlike(const String &str) {
return this;
2021-08-22 21:44:20 +02:00
}
2021-11-01 17:31:04 +01:00
QueryBuilder *QueryBuilder::nvalues(const String &params_str) {
return this;
}
2021-11-01 17:31:04 +01:00
QueryBuilder *QueryBuilder::nval(const String &param) {
2021-08-20 12:49:57 +02:00
return val(escape(param));
}
2021-11-01 17:31:04 +01:00
QueryBuilder *QueryBuilder::nsetp(const String &col, const String &escape_param) {
2021-08-20 12:49:57 +02:00
return setp(col, escape(escape_param));
}
2021-11-01 17:31:04 +01:00
QueryBuilder *QueryBuilder::nwp(const String &col, const String &escape_param) {
return this;
}
2021-08-20 12:49:57 +02:00
2021-08-19 22:03:22 +02:00
QueryBuilder *QueryBuilder::limit(const int num) {
return this;
}
QueryBuilder *QueryBuilder::offset(const int num) {
return this;
}
2021-11-21 16:14:31 +01:00
QueryBuilder *QueryBuilder::order_by_asc(const String &col) {
query_result += "ORDER BY " + col + " ASC, ";
return this;
}
QueryBuilder *QueryBuilder::order_by_desc(const String &col) {
query_result += "ORDER BY " + col + " DESC, ";
return this;
}
QueryBuilder *QueryBuilder::order_by(const String &col) {
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, ";
return this;
}
QueryBuilder *QueryBuilder::desc(const String &col) {
query_result += col + " DESC, ";
return this;
}
QueryBuilder *QueryBuilder::land() {
return this;
}
QueryBuilder *QueryBuilder::lor() {
return this;
}
2021-08-22 21:44:20 +02:00
QueryBuilder *QueryBuilder::wildcard() {
return this;
}
2021-11-01 17:31:04 +01:00
QueryBuilder *QueryBuilder::w(const String &str) {
2021-11-14 19:22:49 +01:00
query_result += str;
2021-08-20 12:49:57 +02:00
return this;
}
2021-11-01 17:31:04 +01:00
QueryBuilder *QueryBuilder::ew(const String &str) {
return w(escape(str));
}
QueryBuilder *QueryBuilder::select_last_insert_id() {
return this;
}
2021-11-01 17:31:04 +01:00
String QueryBuilder::escape(const String &params) {
return params;
}
QueryBuilder *QueryBuilder::prepare() {
return this;
}
2021-11-01 17:31:04 +01:00
QueryBuilder *QueryBuilder::set_param(const int index, const String &value) {
return this;
}
QueryBuilder *QueryBuilder::set_param(const int index, const int value) {
return this;
}
QueryBuilder *QueryBuilder::set_param(const int index, const float value) {
return this;
}
2020-12-01 22:23:28 +01:00
2021-11-14 19:22:49 +01:00
QueryBuilder *QueryBuilder::end_command() {
return this;
}
2021-08-20 12:49:57 +02:00
QueryBuilder *QueryBuilder::reset() {
query_result = "";
return this;
}
Ref<QueryResult> QueryBuilder::run() {
return Ref<QueryResult>();
}
2021-08-19 22:03:22 +02:00
void QueryBuilder::run_query() {
}
2021-11-01 17:31:04 +01:00
String QueryBuilder::get_result() {
end_command();
return query_result;
2020-12-01 22:23:28 +01:00
}
void QueryBuilder::print() {
printf("%s\n", query_result.c_str());
}
QueryBuilder::QueryBuilder() {
}
QueryBuilder::~QueryBuilder() {
}