24 lines
503 B
C++
24 lines
503 B
C++
|
#include "dbinterface.h"
|
||
|
|
||
|
#include "mysql/mysql.h"
|
||
|
|
||
|
DBInterface::DBInterface(Type type):
|
||
|
type(type),
|
||
|
state(State::disconnected)
|
||
|
{}
|
||
|
|
||
|
DBInterface::~DBInterface() {}
|
||
|
|
||
|
std::unique_ptr<DBInterface> DBInterface::create(Type type) {
|
||
|
switch (type) {
|
||
|
case Type::mysql:
|
||
|
return std::make_unique<MySQL>();
|
||
|
}
|
||
|
|
||
|
throw std::runtime_error("Unexpected database type: " + std::to_string((uint8_t)type));
|
||
|
}
|
||
|
|
||
|
DBInterface::State DBInterface::currentState() const {
|
||
|
return state;
|
||
|
}
|