2020-11-27 23:44:56 +01:00
|
|
|
#ifndef MYSQL_CONNECTION
|
|
|
|
#define MYSQL_CONNECTION
|
|
|
|
|
2021-05-15 13:54:28 +02:00
|
|
|
#include "core/database/database.h"
|
2020-12-01 14:47:24 +01:00
|
|
|
|
2020-12-01 21:48:13 +01:00
|
|
|
#include <memory>
|
|
|
|
|
2020-11-27 23:44:56 +01:00
|
|
|
//Brynet has it aswell, and because of using namespace it is defined here aswell
|
|
|
|
//later this will be fixed better
|
|
|
|
#ifdef IS_NUM
|
|
|
|
#undef IS_NUM
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <mysql.h>
|
|
|
|
|
2020-12-01 14:56:05 +01:00
|
|
|
class MysqlDatabase : public Database {
|
2020-12-01 14:47:24 +01:00
|
|
|
public:
|
2020-12-01 18:29:41 +01:00
|
|
|
void connect(const std::string &connection_str);
|
2020-12-02 00:43:46 +01:00
|
|
|
QueryResult *query(const std::string &query);
|
|
|
|
void query_run(const std::string &query);
|
2020-12-01 18:29:41 +01:00
|
|
|
|
2020-12-01 23:37:10 +01:00
|
|
|
QueryBuilder *get_query_builder();
|
|
|
|
TableBuilder *get_table_builder();
|
2020-12-01 21:48:13 +01:00
|
|
|
|
2020-12-01 15:28:59 +01:00
|
|
|
static Database *_creation_func();
|
|
|
|
static void _register();
|
|
|
|
static void _unregister();
|
2020-12-01 14:47:24 +01:00
|
|
|
|
2020-12-01 18:29:41 +01:00
|
|
|
MysqlDatabase();
|
|
|
|
~MysqlDatabase();
|
2020-12-01 14:47:24 +01:00
|
|
|
|
|
|
|
MYSQL *mysql;
|
2020-11-27 23:44:56 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#undef IS_NUM
|
|
|
|
|
|
|
|
#endif
|