1
0
Fork 0
forked from blue/lmdbal

some more primitive specializations, counting rows, dropping tables, tests

This commit is contained in:
Blue 2022-09-17 15:31:58 +03:00
parent 047f96b54a
commit 2f34fa69e8
Signed by untrusted user: blue
GPG key ID: 9B203B252A63EE38
22 changed files with 667 additions and 28 deletions

View file

@ -38,7 +38,7 @@ std::string DataBase::Directory::getMessage() const {
DataBase::Closed::Closed(
const std::string& p_operation,
const std::string& p_dbName,
const std::string& p_tableName
const std::optional<std::string>& p_tableName
):
Exception(),
operation(p_operation),
@ -46,22 +46,25 @@ DataBase::Closed::Closed(
tableName(p_tableName) {}
std::string DataBase::Closed::getMessage() const {
return "An attempt to perform operation " + operation
+ " on closed database " + dbName
+ " on table " + tableName;
std::string msg = "An attempt to perform operation " + operation
+ " on closed database " + dbName;
if (tableName.has_value()) {
msg += + " on table " + tableName.value();
}
return msg;
}
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_action):
Exception(),
dbName(p_dbName),
tableName(p_tableName) {}
action(p_action) {}
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.";
return "An attempt to " + action
+ " (the database " + dbName
+ ") but it's can't be done because the DataBase is already opened";
}
DataBase::NotFound::NotFound(