Refactor RDBMS functions for catching SQL exceptions
Currently, we are using logic in the code to handle constraints in the DB. This is not best practice, example:
void RdbmsDiskSystemCatalogue::createDiskSystem(const common::dataStructures::SecurityIdentity &admin,
const std::string &name, const std::string &diskInstanceName, const std::string &diskInstanceSpaceName,
const std::string &fileRegexp, const uint64_t targetedFreeSpace, const time_t sleepTime, const std::string &comment) {
try {
if(name.empty()) {
throw UserSpecifiedAnEmptyStringDiskSystemName("Cannot create disk system because the name is an empty string");
}
We should instead let the database handle the exception throwing. Especially for:
-
Unique constraints -
Foreign key constraints
Edited by Lasse Tjernaes Wardenaer