1
0
Fork 0
forked from blue/lmdbal

finally, first working prototype

This commit is contained in:
Blue 2022-09-15 01:18:31 +03:00
parent d67a3c32eb
commit 5f90a21fe6
Signed by untrusted user: blue
GPG key ID: 9B203B252A63EE38
11 changed files with 193 additions and 112 deletions

View file

@ -16,14 +16,14 @@
#include "exceptions.h"
Core::DataBase::Directory::Directory(const std::string& p_path):
DataBase::Directory::Directory(const std::string& p_path):
Exception(),
path(p_path) {}
std::string Core::DataBase::Directory::getMessage() const {
std::string DataBase::Directory::getMessage() const {
return "Can't create directory for database at " + path;}
Core::DataBase::Closed::Closed(
DataBase::Closed::Closed(
const std::string& p_operation,
const std::string& p_dbName,
const std::string& p_tableName
@ -33,26 +33,26 @@ Core::DataBase::Closed::Closed(
dbName(p_dbName),
tableName(p_tableName) {}
std::string Core::DataBase::Closed::getMessage() const {
std::string DataBase::Closed::getMessage() const {
return "An attempt to perform operation " + operation
+ " on closed database " + dbName
+ " on table " + tableName;
}
Core::DataBase::Opened::Opened(const std::string& p_dbName, const std::string& p_tableName):
DataBase::Opened::Opened(const std::string& p_dbName, const std::string& p_tableName):
Exception(),
dbName(p_dbName),
tableName(p_tableName) {}
std::string Core::DataBase::Opened::getMessage() const {
std::string DataBase::Opened::getMessage() const {
return "An attempt to add table " + tableName
+ " to the database " + dbName
+ " but it's can't be done because the DataBase is already opened."
+ " Please add all tables before opening DataBase.";
}
Core::DataBase::NotFound::NotFound(
DataBase::NotFound::NotFound(
const std::string& p_key,
const std::string& p_dbName,
const std::string& p_tableName
@ -62,12 +62,12 @@ Core::DataBase::NotFound::NotFound(
dbName(p_dbName),
tableName(p_tableName) {}
std::string Core::DataBase::NotFound::getMessage() const {
std::string DataBase::NotFound::getMessage() const {
return "Element for id " + key + " wasn't found "
+ " in database " + dbName
+ " in table " + tableName;}
Core::DataBase::Exist::Exist(
DataBase::Exist::Exist(
const std::string& p_key,
const std::string& p_dbName,
const std::string& p_tableName
@ -77,14 +77,14 @@ Core::DataBase::Exist::Exist(
dbName(p_dbName),
tableName(p_tableName) {}
std::string Core::DataBase::Exist::getMessage() const {
std::string DataBase::Exist::getMessage() const {
return "An attempt to insert element with key " + key
+ " to database " + dbName
+ " to table " + tableName
+ " but it already has an element with given id";
}
Core::DataBase::Unknown::Unknown(
DataBase::Unknown::Unknown(
const std::string& p_dbName,
const std::string& message,
const std::optional<std::string>& p_tableName
@ -94,7 +94,7 @@ Core::DataBase::Unknown::Unknown(
tableName(p_tableName),
msg(message) {}
std::string Core::DataBase::Unknown::getMessage() const
std::string DataBase::Unknown::getMessage() const
{
std::string result = "Unknown error in database " + dbName;
if (tableName.has_value()) {