2021-05-01 20:31:52 +02:00
|
|
|
#ifndef MYSQL_QUERY_RESULT_H
|
|
|
|
#define MYSQL_QUERY_RESULT_H
|
|
|
|
|
2021-05-01 21:53:01 +02:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2021-05-15 13:54:28 +02:00
|
|
|
#include "core/database/query_result.h"
|
2021-05-01 20:31:52 +02:00
|
|
|
|
2021-05-01 23:35:37 +02:00
|
|
|
#include "./sqlite/sqlite3.h"
|
2021-05-01 20:31:52 +02:00
|
|
|
|
|
|
|
class Sqlite3QueryResult : public QueryResult {
|
|
|
|
public:
|
|
|
|
bool next_row();
|
|
|
|
const char* get_cell(const int index);
|
2021-08-20 01:32:43 +02:00
|
|
|
int get_last_insert_rowid();
|
2021-05-01 20:31:52 +02:00
|
|
|
|
2021-05-01 21:53:01 +02:00
|
|
|
void query(const std::string &query, sqlite3 *conn);
|
|
|
|
|
|
|
|
static int run_query_finished(void *data, int argc, char **argv, char **col_names);
|
|
|
|
|
2021-05-01 20:31:52 +02:00
|
|
|
Sqlite3QueryResult();
|
|
|
|
~Sqlite3QueryResult();
|
2021-05-01 21:53:01 +02:00
|
|
|
|
|
|
|
char* err_msg;
|
|
|
|
|
|
|
|
public:
|
|
|
|
struct Sqlite3QueryResultRow {
|
|
|
|
std::vector<std::string> cells;
|
|
|
|
};
|
|
|
|
|
|
|
|
char **col_names;
|
|
|
|
std::vector<Sqlite3QueryResultRow *> rows;
|
|
|
|
int current_row;
|
2021-08-20 01:32:43 +02:00
|
|
|
|
|
|
|
sqlite3 *_connection;
|
2021-05-01 20:31:52 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|