2020-12-01 22:23:28 +01:00
|
|
|
#include "mysql_query_builder.h"
|
2020-12-01 21:48:13 +01:00
|
|
|
|
2020-12-01 22:23:28 +01:00
|
|
|
|
|
|
|
QueryBuilder *MysqlQueryBuilder::select(const std::string ¶ms) {
|
2020-12-01 21:48:13 +01:00
|
|
|
query_result += "SELECT " + params;
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
QueryBuilder *MysqlQueryBuilder::where(const std::string ¶ms) {
|
|
|
|
query_result += " WHERE " + params;
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
QueryBuilder *MysqlQueryBuilder::from(const std::string ¶ms) {
|
|
|
|
query_result += " FROM " + params;
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
QueryBuilder *MysqlQueryBuilder::limit(const int min, const int max) {
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
QueryBuilder *MysqlQueryBuilder::insert(const std::string &table_name, const std::string ¶ms_str) {
|
2020-12-02 00:43:46 +01:00
|
|
|
query_result += " INSERT INTO " + table_name + " VALUES( " + params_str + " );";
|
|
|
|
|
2020-12-01 21:48:13 +01:00
|
|
|
return this;
|
2020-12-01 22:23:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void MysqlQueryBuilder::finalize() {
|
|
|
|
query_result += ";";
|
|
|
|
}
|
2020-12-01 21:48:13 +01:00
|
|
|
|
|
|
|
MysqlQueryBuilder::MysqlQueryBuilder() {
|
|
|
|
|
|
|
|
}
|
|
|
|
MysqlQueryBuilder::~MysqlQueryBuilder() {
|
|
|
|
|
2020-12-01 22:23:28 +01:00
|
|
|
}
|