2020-11-28 14:30:50 +01:00
|
|
|
#ifndef SQLITE3_CONNECTION
|
|
|
|
#define SQLITE3_CONNECTION
|
|
|
|
|
2020-12-01 14:53:32 +01:00
|
|
|
#include "core/database.h"
|
|
|
|
|
2020-11-28 14:30:50 +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 <cstdio>
|
|
|
|
|
|
|
|
#include <sqlite3.h>
|
|
|
|
|
2020-12-01 14:56:05 +01:00
|
|
|
class SQLite3Database : public Database {
|
2020-11-28 14:30:50 +01:00
|
|
|
public:
|
2020-12-01 15:28:59 +01:00
|
|
|
static Database *_creation_func();
|
|
|
|
static void _register();
|
|
|
|
static void _unregister();
|
2020-12-01 14:53:32 +01:00
|
|
|
|
2020-12-01 14:56:05 +01:00
|
|
|
SQLite3Database() :
|
2020-12-01 14:53:32 +01:00
|
|
|
Database() {
|
2020-11-28 14:30:50 +01:00
|
|
|
|
|
|
|
int ret = sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
|
|
|
|
if (ret != SQLITE_OK) {
|
|
|
|
printf("SQLITE3 multithreading is not supported!\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = sqlite3_open("", &conn);
|
|
|
|
}
|
|
|
|
|
2020-12-01 14:56:05 +01:00
|
|
|
~SQLite3Database() {
|
2020-11-28 14:30:50 +01:00
|
|
|
sqlite3_close(conn);
|
|
|
|
}
|
|
|
|
|
|
|
|
sqlite3 *conn;
|
|
|
|
};
|
|
|
|
|
|
|
|
//#undef IS_NUM
|
|
|
|
|
|
|
|
#endif
|