27 lines
617 B
C++
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;
|
|
}
|