|
|
|
#ifndef _MARCELB_SQLITE3_
|
|
|
|
#define _MARCELB_SQLITE3_
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <sqlite3.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
|
|
|
#include <iostream>
|
|
|
|
#include <mutex>
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
namespace marcelb::SQlite3 {
|
|
|
|
|
|
|
|
static string responseDatabase;
|
|
|
|
static int callback(void* data, int argc, char** argv, char** azColName);
|
|
|
|
|
|
|
|
class SQLite3 {
|
|
|
|
mutex io;
|
|
|
|
sqlite3* db;
|
|
|
|
string path;
|
|
|
|
bool keepOpen;
|
|
|
|
|
|
|
|
bool open();
|
|
|
|
bool close();
|
|
|
|
map<string, vector<string>> parse(const string& result);
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
// string Answer;
|
|
|
|
// map<string, vector<string>> parsed;
|
|
|
|
|
|
|
|
SQLite3(const string path, bool _keepOpen = false);
|
|
|
|
|
|
|
|
// map<string, vector<string>> query(const string sql_command);
|
|
|
|
std::map<std::string, std::vector<std::string>> query(const std::string& sql_command, const std::vector<std::string>& values);
|
|
|
|
|
|
|
|
~SQLite3();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|