rcpp_framework/database/sqlite/sqlite3_query_result.h

50 lines
831 B
C++

#ifndef MYSQL_QUERY_RESULT_H
#define MYSQL_QUERY_RESULT_H
#include <string>
#include <vector>
#include "core/database/query_result.h"
#include "./sqlite/sqlite3.h"
class Sqlite3QueryResult : public QueryResult {
public:
bool next_row();
const char* get_cell(const int index);
bool is_cell_null(const int index);
int get_last_insert_rowid();
void query(const std::string &query, sqlite3 *conn);
static int run_query_finished(void *data, int argc, char **argv, char **col_names);
Sqlite3QueryResult();
~Sqlite3QueryResult();
char* err_msg;
public:
struct Cell {
bool null;
std::string data;
Cell() {
null = false;
}
};
struct Sqlite3QueryResultRow {
std::vector<Cell> cells;
};
char **col_names;
std::vector<Sqlite3QueryResultRow *> rows;
int current_row;
sqlite3 *_connection;
};
#endif