mirror of https://github.com/Icinga/icinga2.git
Move the ClearConfigTables function into the DbConnection class.
Refs #5565
This commit is contained in:
parent
6c724d2797
commit
3a23f0110b
|
@ -233,40 +233,6 @@ void IdoMysqlConnection::Reconnect(void)
|
|||
UpdateAllObjects();
|
||||
}
|
||||
|
||||
void IdoMysqlConnection::ClearConfigTables(void)
|
||||
{
|
||||
/* TODO make hardcoded table names modular */
|
||||
ClearConfigTable("commands");
|
||||
ClearConfigTable("comments");
|
||||
ClearConfigTable("contact_addresses");
|
||||
ClearConfigTable("contact_notificationcommands");
|
||||
ClearConfigTable("contactgroup_members");
|
||||
ClearConfigTable("contactgroups");
|
||||
ClearConfigTable("contacts");
|
||||
ClearConfigTable("contactstatus");
|
||||
ClearConfigTable("customvariables");
|
||||
ClearConfigTable("customvariablestatus");
|
||||
ClearConfigTable("host_contactgroups");
|
||||
ClearConfigTable("host_contacts");
|
||||
ClearConfigTable("host_parenthosts");
|
||||
ClearConfigTable("hostdependencies");
|
||||
ClearConfigTable("hostgroup_members");
|
||||
ClearConfigTable("hostgroups");
|
||||
ClearConfigTable("hosts");
|
||||
ClearConfigTable("hoststatus");
|
||||
ClearConfigTable("programstatus");
|
||||
ClearConfigTable("scheduleddowntime");
|
||||
ClearConfigTable("service_contactgroups");
|
||||
ClearConfigTable("service_contacts");
|
||||
ClearConfigTable("servicedependencies");
|
||||
ClearConfigTable("servicegroup_members");
|
||||
ClearConfigTable("servicegroups");
|
||||
ClearConfigTable("services");
|
||||
ClearConfigTable("servicestatus");
|
||||
ClearConfigTable("timeperiod_timeranges");
|
||||
ClearConfigTable("timeperiods");
|
||||
}
|
||||
|
||||
void IdoMysqlConnection::ClearConfigTable(const String& table)
|
||||
{
|
||||
Query("DELETE FROM " + GetTablePrefix() + table + " WHERE instance_id = " + Convert::ToString(static_cast<long>(m_InstanceID)));
|
||||
|
|
|
@ -83,8 +83,7 @@ private:
|
|||
void InternalExecuteQuery(const DbQuery& query);
|
||||
void InternalCleanUpExecuteQuery(const String& table, const String& time_key, double time_value);
|
||||
|
||||
void ClearConfigTables(void);
|
||||
void ClearConfigTable(const String& table);
|
||||
virtual void ClearConfigTable(const String& table);
|
||||
|
||||
void ExceptionHandler(boost::exception_ptr exp);
|
||||
};
|
||||
|
|
|
@ -236,40 +236,6 @@ void IdoPgsqlConnection::Reconnect(void)
|
|||
UpdateAllObjects();
|
||||
}
|
||||
|
||||
void IdoPgsqlConnection::ClearConfigTables(void)
|
||||
{
|
||||
/* TODO make hardcoded table names modular */
|
||||
ClearConfigTable("commands");
|
||||
ClearConfigTable("comments");
|
||||
ClearConfigTable("contact_addresses");
|
||||
ClearConfigTable("contact_notificationcommands");
|
||||
ClearConfigTable("contactgroup_members");
|
||||
ClearConfigTable("contactgroups");
|
||||
ClearConfigTable("contacts");
|
||||
ClearConfigTable("contactstatus");
|
||||
ClearConfigTable("customvariables");
|
||||
ClearConfigTable("customvariablestatus");
|
||||
ClearConfigTable("host_contactgroups");
|
||||
ClearConfigTable("host_contacts");
|
||||
ClearConfigTable("host_parenthosts");
|
||||
ClearConfigTable("hostdependencies");
|
||||
ClearConfigTable("hostgroup_members");
|
||||
ClearConfigTable("hostgroups");
|
||||
ClearConfigTable("hosts");
|
||||
ClearConfigTable("hoststatus");
|
||||
ClearConfigTable("programstatus");
|
||||
ClearConfigTable("scheduleddowntime");
|
||||
ClearConfigTable("service_contactgroups");
|
||||
ClearConfigTable("service_contacts");
|
||||
ClearConfigTable("servicedependencies");
|
||||
ClearConfigTable("servicegroup_members");
|
||||
ClearConfigTable("servicegroups");
|
||||
ClearConfigTable("services");
|
||||
ClearConfigTable("servicestatus");
|
||||
ClearConfigTable("timeperiod_timeranges");
|
||||
ClearConfigTable("timeperiods");
|
||||
}
|
||||
|
||||
void IdoPgsqlConnection::ClearConfigTable(const String& table)
|
||||
{
|
||||
Query("DELETE FROM " + GetTablePrefix() + table + " WHERE instance_id = " + Convert::ToString(static_cast<long>(m_InstanceID)));
|
||||
|
|
|
@ -81,8 +81,7 @@ private:
|
|||
void InternalExecuteQuery(const DbQuery& query);
|
||||
void InternalCleanUpExecuteQuery(const String& table, const String& time_key, double time_value);
|
||||
|
||||
void ClearConfigTables(void);
|
||||
void ClearConfigTable(const String& table);
|
||||
virtual void ClearConfigTable(const String& table);
|
||||
|
||||
void ExceptionHandler(boost::exception_ptr exp);
|
||||
};
|
||||
|
|
|
@ -292,3 +292,37 @@ void DbConnection::UpdateAllObjects(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DbConnection::ClearConfigTables(void)
|
||||
{
|
||||
/* TODO make hardcoded table names modular */
|
||||
ClearConfigTable("commands");
|
||||
ClearConfigTable("comments");
|
||||
ClearConfigTable("contact_addresses");
|
||||
ClearConfigTable("contact_notificationcommands");
|
||||
ClearConfigTable("contactgroup_members");
|
||||
ClearConfigTable("contactgroups");
|
||||
ClearConfigTable("contacts");
|
||||
ClearConfigTable("contactstatus");
|
||||
ClearConfigTable("customvariables");
|
||||
ClearConfigTable("customvariablestatus");
|
||||
ClearConfigTable("host_contactgroups");
|
||||
ClearConfigTable("host_contacts");
|
||||
ClearConfigTable("host_parenthosts");
|
||||
ClearConfigTable("hostdependencies");
|
||||
ClearConfigTable("hostgroup_members");
|
||||
ClearConfigTable("hostgroups");
|
||||
ClearConfigTable("hosts");
|
||||
ClearConfigTable("hoststatus");
|
||||
ClearConfigTable("programstatus");
|
||||
ClearConfigTable("scheduleddowntime");
|
||||
ClearConfigTable("service_contactgroups");
|
||||
ClearConfigTable("service_contacts");
|
||||
ClearConfigTable("servicedependencies");
|
||||
ClearConfigTable("servicegroup_members");
|
||||
ClearConfigTable("servicegroups");
|
||||
ClearConfigTable("services");
|
||||
ClearConfigTable("servicestatus");
|
||||
ClearConfigTable("timeperiod_timeranges");
|
||||
ClearConfigTable("timeperiods");
|
||||
}
|
||||
|
|
|
@ -72,6 +72,8 @@ protected:
|
|||
|
||||
void UpdateAllObjects(void);
|
||||
|
||||
void ClearConfigTables(void);
|
||||
|
||||
private:
|
||||
std::map<DbObject::Ptr, DbReference> m_ObjectIDs;
|
||||
std::map<DbObject::Ptr, DbReference> m_InsertIDs;
|
||||
|
@ -83,6 +85,8 @@ private:
|
|||
|
||||
void CleanUpHandler(void);
|
||||
|
||||
virtual void ClearConfigTable(const String& table) = 0;
|
||||
|
||||
static Timer::Ptr m_ProgramStatusTimer;
|
||||
|
||||
static void InsertRuntimeVariable(const String& key, const Value& value);
|
||||
|
|
Loading…
Reference in New Issue