Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GAIAPLAT-908] Correct typo in forbidden_sydtem_db_operation exception name #651

Merged
merged 3 commits into from
May 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 6 additions & 19 deletions production/catalog/src/catalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ namespace gaia
namespace catalog
{

bool is_system_db(const string& name)
inline void check_not_system_db(const string& name)
{
if (name == c_catalog_db_name || name == c_event_log_db_name)
{
return true;
throw forbidden_system_db_operation(name);
}
return false;
}

void initialize_catalog()
Expand All @@ -32,10 +31,7 @@ void initialize_catalog()

void use_database(const string& name)
{
if (is_system_db(name))
{
throw forbidden_sydtem_db_operation(name);
}
check_not_system_db(name);
ddl_executor_t::get().switch_db_context(name);
}

Expand All @@ -55,10 +51,7 @@ gaia_id_t create_table(
const ddl::field_def_list_t& fields,
bool throw_on_exists)
{
if (is_system_db(db_name))
{
throw forbidden_sydtem_db_operation(db_name);
}
check_not_system_db(name);
return ddl_executor_t::get().create_table(db_name, name, fields, throw_on_exists);
}

Expand All @@ -73,10 +66,7 @@ gaia_id_t create_relationship(

void drop_database(const string& name, bool throw_unless_exists)
{
if (is_system_db(name))
{
throw forbidden_sydtem_db_operation(name);
}
check_not_system_db(name);
return ddl_executor_t::get().drop_database(name, throw_unless_exists);
}

Expand All @@ -87,10 +77,7 @@ void drop_table(const string& name, bool throw_unless_exists)

void drop_table(const string& db_name, const string& name, bool throw_unless_exists)
{
if (is_system_db(name))
{
throw forbidden_sydtem_db_operation(name);
}
check_not_system_db(name);
return ddl_executor_t::get().drop_table(db_name, name, throw_unless_exists);
}

Expand Down
4 changes: 2 additions & 2 deletions production/inc/gaia_internal/catalog/catalog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,10 @@ struct drop_statement_t : statement_t
/*@}*/
} // namespace ddl

class forbidden_sydtem_db_operation : public gaia::common::gaia_exception
class forbidden_system_db_operation : public gaia::common::gaia_exception
{
public:
explicit forbidden_sydtem_db_operation(const std::string& name)
explicit forbidden_system_db_operation(const std::string& name)
{
m_message = "Operations on the system database '" + name + "' are not allowed.";
}
Expand Down