2021-12-05 17:54:36 +00:00
|
|
|
#include "CDClientDatabase.h"
|
|
|
|
#include "CDComponentsRegistryTable.h"
|
|
|
|
|
|
|
|
// Static Variables
|
|
|
|
static CppSQLite3DB* conn = new CppSQLite3DB();
|
|
|
|
|
2024-01-08 23:32:09 +00:00
|
|
|
// Status Variables
|
|
|
|
bool CDClientDatabase::isConnected = false;
|
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
//! Opens a connection with the CDClient
|
|
|
|
void CDClientDatabase::Connect(const std::string& filename) {
|
|
|
|
conn->open(filename.c_str());
|
2024-01-08 23:32:09 +00:00
|
|
|
isConnected = true;
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//! Queries the CDClient
|
|
|
|
CppSQLite3Query CDClientDatabase::ExecuteQuery(const std::string& query) {
|
|
|
|
return conn->execQuery(query.c_str());
|
|
|
|
}
|
2022-01-13 03:48:27 +00:00
|
|
|
|
2022-10-30 07:38:43 +00:00
|
|
|
//! Updates the CDClient file with Data Manipulation Language (DML) commands.
|
|
|
|
int CDClientDatabase::ExecuteDML(const std::string& query) {
|
|
|
|
return conn->execDML(query.c_str());
|
|
|
|
}
|
|
|
|
|
2022-01-13 03:48:27 +00:00
|
|
|
//! Makes prepared statements
|
|
|
|
CppSQLite3Statement CDClientDatabase::CreatePreppedStmt(const std::string& query) {
|
|
|
|
return conn->compileStatement(query.c_str());
|
|
|
|
}
|