mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2024-11-10 00:52:11 +01:00
Little work on the sqlite database backend.
This commit is contained in:
parent
06cd3e0f6b
commit
ec8de94827
@ -13,3 +13,28 @@ void SQLite3Database::_register() {
|
||||
void SQLite3Database::_unregister() {
|
||||
DatabaseManager::_unregister_db_creation_func("sqlite");
|
||||
}
|
||||
|
||||
void SQLite3Database::connect(const std::string &connection_str) {
|
||||
int ret = sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
|
||||
if (ret != SQLITE_OK) {
|
||||
printf("SQLITE3 multithreading is not supported!\n");
|
||||
}
|
||||
|
||||
ret = sqlite3_open(connection_str.c_str(), &conn);
|
||||
}
|
||||
|
||||
QueryResult *SQLite3Database::query(const std::string &query) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void SQLite3Database::query_run(const std::string &query) {
|
||||
}
|
||||
|
||||
SQLite3Database::SQLite3Database() :
|
||||
Database() {
|
||||
}
|
||||
|
||||
SQLite3Database::~SQLite3Database() {
|
||||
if (conn)
|
||||
sqlite3_close(conn);
|
||||
}
|
||||
|
@ -19,20 +19,12 @@ public:
|
||||
static void _register();
|
||||
static void _unregister();
|
||||
|
||||
SQLite3Database() :
|
||||
Database() {
|
||||
void connect(const std::string &connection_str);
|
||||
QueryResult *query(const std::string &query);
|
||||
void query_run(const std::string &query);
|
||||
|
||||
int ret = sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
|
||||
if (ret != SQLITE_OK) {
|
||||
printf("SQLITE3 multithreading is not supported!\n");
|
||||
}
|
||||
|
||||
ret = sqlite3_open("", &conn);
|
||||
}
|
||||
|
||||
~SQLite3Database() {
|
||||
sqlite3_close(conn);
|
||||
}
|
||||
SQLite3Database();
|
||||
~SQLite3Database();
|
||||
|
||||
sqlite3 *conn;
|
||||
};
|
||||
|
17
database/sqlite/sqlite3_query_result.cpp
Normal file
17
database/sqlite/sqlite3_query_result.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include "sqlite3_query_result.h"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
bool Sqlite3QueryResult::next_row() {
|
||||
return false;
|
||||
}
|
||||
|
||||
const char* Sqlite3QueryResult::get_cell(const int index) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Sqlite3QueryResult::Sqlite3QueryResult() : QueryResult() {
|
||||
}
|
||||
|
||||
Sqlite3QueryResult::~Sqlite3QueryResult() {
|
||||
}
|
17
database/sqlite/sqlite3_query_result.h
Normal file
17
database/sqlite/sqlite3_query_result.h
Normal file
@ -0,0 +1,17 @@
|
||||
#ifndef MYSQL_QUERY_RESULT_H
|
||||
#define MYSQL_QUERY_RESULT_H
|
||||
|
||||
#include "core/query_result.h"
|
||||
|
||||
#include <sqlite3.h>
|
||||
|
||||
class Sqlite3QueryResult : public QueryResult {
|
||||
public:
|
||||
bool next_row();
|
||||
const char* get_cell(const int index);
|
||||
|
||||
Sqlite3QueryResult();
|
||||
~Sqlite3QueryResult();
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user