1
0
forked from blue/pica
pica/database/interface.cpp
2023-12-29 14:40:00 -03:00

27 lines
617 B
C++

// SPDX-FileCopyrightText: 2023 Yury Gubich <blue@macaw.me>
// SPDX-License-Identifier: GPL-3.0-or-later
#include "interface.h"
#include "mysql/mysql.h"
DB::Interface::Interface(Type type):
type(type),
state(State::disconnected)
{}
DB::Interface::~Interface() {}
std::unique_ptr<DB::Interface> DB::Interface::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));
}
DB::Interface::State DB::Interface::currentState() const {
return state;
}