2020-12-01 21:48:13 +01:00
|
|
|
#ifndef MYSQL_QUERY_BUILDER_H
|
|
|
|
#define MYSQL_QUERY_BUILDER_H
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <string>
|
|
|
|
|
2021-05-15 13:54:28 +02:00
|
|
|
#include "core/database/query_builder.h"
|
2020-12-01 22:23:28 +01:00
|
|
|
|
2021-08-19 14:12:02 +02:00
|
|
|
class MysqlDatabase;
|
|
|
|
class MysqlQueryResult;
|
|
|
|
|
2020-12-01 21:48:13 +01:00
|
|
|
class MysqlQueryBuilder : public QueryBuilder {
|
|
|
|
public:
|
2021-08-19 14:12:02 +02:00
|
|
|
QueryBuilder *select();
|
|
|
|
QueryBuilder *where();
|
|
|
|
QueryBuilder *from();
|
|
|
|
QueryBuilder *insert();
|
|
|
|
QueryBuilder *values();
|
|
|
|
QueryBuilder *cvalues();
|
|
|
|
|
2020-12-01 21:48:13 +01:00
|
|
|
QueryBuilder *select(const std::string ¶ms);
|
|
|
|
QueryBuilder *where(const std::string ¶ms);
|
|
|
|
QueryBuilder *from(const std::string ¶ms);
|
2021-08-19 14:12:02 +02:00
|
|
|
QueryBuilder *insert(const std::string &table_name);
|
|
|
|
QueryBuilder *values(const std::string ¶ms_str);
|
|
|
|
|
2021-08-19 22:03:22 +02:00
|
|
|
QueryBuilder *limit(const int num);
|
|
|
|
QueryBuilder *offset(const int num);
|
2020-12-01 22:23:28 +01:00
|
|
|
|
2021-08-19 14:12:02 +02:00
|
|
|
std::string escape(const std::string ¶ms);
|
|
|
|
|
|
|
|
QueryBuilder *prepare();
|
|
|
|
QueryBuilder *set_param(const int index, const std::string &value);
|
|
|
|
QueryBuilder *set_param(const int index, const int value);
|
|
|
|
QueryBuilder *set_param(const int index, const float value);
|
|
|
|
|
|
|
|
void end_command();
|
|
|
|
|
|
|
|
QueryResult *run();
|
2021-08-19 22:03:22 +02:00
|
|
|
void run_query();
|
2021-08-19 14:12:02 +02:00
|
|
|
|
|
|
|
MysqlQueryBuilder();
|
|
|
|
~MysqlQueryBuilder();
|
|
|
|
|
|
|
|
MysqlDatabase *_db;
|
2020-12-01 21:48:13 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|