]> granicus.if.org Git - icinga2/commitdiff
ido: Rename component with ido prefix.
authorMichael Friedrich <michael.friedrich@netways.de>
Fri, 16 Aug 2013 09:15:05 +0000 (11:15 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Fri, 16 Aug 2013 09:15:05 +0000 (11:15 +0200)
This marks the configuration object as ido specific mysql db connection.

refs #3307

components/ido_mysql/Makefile.am
components/ido_mysql/ido_mysql-type.conf
components/ido_mysql/idomysqldbconnection.cpp [moved from components/ido_mysql/mysqldbconnection.cpp with 90% similarity]
components/ido_mysql/idomysqldbconnection.h [moved from components/ido_mysql/mysqldbconnection.h with 88% similarity]

index 8e48e0e430948f225c46d26ede960e14df136db9..65ee462f18121f1fb4cc8124de8fca1e81d8751d 100644 (file)
@@ -12,8 +12,8 @@ EXTRA_DIST = \
 
 libido_mysql_la_SOURCES = \
        ido_mysql-type.cpp \
-       mysqldbconnection.cpp \
-       mysqldbconnection.h
+       idomysqldbconnection.cpp \
+       idomysqldbconnection.h
 
 libido_mysql_la_CPPFLAGS = \
        $(LTDLINCL) \
index 4e8d16df99c82283d478c9693124c2b35ad8da0b..d5bb20726f88714a6df348a5ff45b1f725283699 100644 (file)
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-type MysqlDbConnection inherits DbConnection {
+type IdoMysqlDbConnection inherits DbConnection {
        %attribute string "host",
        %attribute number "port",
 
similarity index 90%
rename from components/ido_mysql/mysqldbconnection.cpp
rename to components/ido_mysql/idomysqldbconnection.cpp
index 36a97dbf8f08b8aade010142a613e32c7533b1ce..8dd322f40eb96618c60bc707e4ece767e56716ca 100644 (file)
 #include "base/utility.h"
 #include "ido/dbtype.h"
 #include "ido/dbvalue.h"
-#include "ido_mysql/mysqldbconnection.h"
+#include "ido_mysql/idomysqldbconnection.h"
 #include <boost/tuple/tuple.hpp>
 #include <boost/smart_ptr/make_shared.hpp>
 #include <boost/foreach.hpp>
 
 using namespace icinga;
 
-REGISTER_TYPE(MysqlDbConnection);
+REGISTER_TYPE(IdoMysqlDbConnection);
 
-MysqlDbConnection::MysqlDbConnection(const Dictionary::Ptr& serializedUpdate)
+IdoMysqlDbConnection::IdoMysqlDbConnection(const Dictionary::Ptr& serializedUpdate)
        : DbConnection(serializedUpdate), m_Connected(false)
 {
        RegisterAttribute("host", Attribute_Config, &m_Host);
@@ -46,18 +46,18 @@ MysqlDbConnection::MysqlDbConnection(const Dictionary::Ptr& serializedUpdate)
 
        m_TxTimer = boost::make_shared<Timer>();
        m_TxTimer->SetInterval(5);
-       m_TxTimer->OnTimerExpired.connect(boost::bind(&MysqlDbConnection::TxTimerHandler, this));
+       m_TxTimer->OnTimerExpired.connect(boost::bind(&IdoMysqlDbConnection::TxTimerHandler, this));
        m_TxTimer->Start();
 
        m_ReconnectTimer = boost::make_shared<Timer>();
        m_ReconnectTimer->SetInterval(10);
-       m_ReconnectTimer->OnTimerExpired.connect(boost::bind(&MysqlDbConnection::ReconnectTimerHandler, this));
+       m_ReconnectTimer->OnTimerExpired.connect(boost::bind(&IdoMysqlDbConnection::ReconnectTimerHandler, this));
        m_ReconnectTimer->Start();
 
        ASSERT(mysql_thread_safe());
 }
 
-void MysqlDbConnection::Stop(void)
+void IdoMysqlDbConnection::Stop(void)
 {
        boost::mutex::scoped_lock lock(m_ConnectionMutex);
 
@@ -68,7 +68,7 @@ void MysqlDbConnection::Stop(void)
        mysql_close(&m_Connection);
 }
 
-void MysqlDbConnection::TxTimerHandler(void)
+void IdoMysqlDbConnection::TxTimerHandler(void)
 {
        boost::mutex::scoped_lock lock(m_ConnectionMutex);
 
@@ -79,7 +79,7 @@ void MysqlDbConnection::TxTimerHandler(void)
        Query("BEGIN");
 }
 
-void MysqlDbConnection::ReconnectTimerHandler(void)
+void IdoMysqlDbConnection::ReconnectTimerHandler(void)
 {
        {
                boost::mutex::scoped_lock lock(m_ConnectionMutex);
@@ -160,7 +160,7 @@ void MysqlDbConnection::ReconnectTimerHandler(void)
        UpdateAllObjects();
 }
 
-void MysqlDbConnection::ClearConfigTables(void)
+void IdoMysqlDbConnection::ClearConfigTables(void)
 {
        /* TODO make hardcoded table names modular */
        ClearConfigTable("commands");
@@ -187,12 +187,12 @@ void MysqlDbConnection::ClearConfigTables(void)
        ClearConfigTable("timeperiods");
 }
 
-void MysqlDbConnection::ClearConfigTable(const String& table)
+void IdoMysqlDbConnection::ClearConfigTable(const String& table)
 {
        Query("DELETE FROM " + GetTablePrefix() + table + " WHERE instance_id = " + Convert::ToString(static_cast<long>(m_InstanceID)));
 }
 
-Array::Ptr MysqlDbConnection::Query(const String& query)
+Array::Ptr IdoMysqlDbConnection::Query(const String& query)
 {
        Log(LogDebug, "ido_mysql", "Query: " + query);
 
@@ -224,12 +224,12 @@ Array::Ptr MysqlDbConnection::Query(const String& query)
        return rows;
 }
 
-DbReference MysqlDbConnection::GetLastInsertID(void)
+DbReference IdoMysqlDbConnection::GetLastInsertID(void)
 {
        return DbReference(mysql_insert_id(&m_Connection));
 }
 
-String MysqlDbConnection::Escape(const String& s)
+String IdoMysqlDbConnection::Escape(const String& s)
 {
        ssize_t length = s.GetLength();
        char *to = new char[s.GetLength() * 2 + 1];
@@ -243,7 +243,7 @@ String MysqlDbConnection::Escape(const String& s)
        return result;
 }
 
-Dictionary::Ptr MysqlDbConnection::FetchRow(MYSQL_RES *result)
+Dictionary::Ptr IdoMysqlDbConnection::FetchRow(MYSQL_RES *result)
 {
        MYSQL_ROW row;
        MYSQL_FIELD *field;
@@ -274,13 +274,13 @@ Dictionary::Ptr MysqlDbConnection::FetchRow(MYSQL_RES *result)
        return dict;
 }
 
-void MysqlDbConnection::ActivateObject(const DbObject::Ptr& dbobj)
+void IdoMysqlDbConnection::ActivateObject(const DbObject::Ptr& dbobj)
 {
        boost::mutex::scoped_lock lock(m_ConnectionMutex);
        InternalActivateObject(dbobj);
 }
 
-void MysqlDbConnection::InternalActivateObject(const DbObject::Ptr& dbobj)
+void IdoMysqlDbConnection::InternalActivateObject(const DbObject::Ptr& dbobj)
 {
        if (!m_Connected)
                return;
@@ -300,7 +300,7 @@ void MysqlDbConnection::InternalActivateObject(const DbObject::Ptr& dbobj)
        }
 }
 
-void MysqlDbConnection::DeactivateObject(const DbObject::Ptr& dbobj)
+void IdoMysqlDbConnection::DeactivateObject(const DbObject::Ptr& dbobj)
 {
        boost::mutex::scoped_lock lock(m_ConnectionMutex);
 
@@ -321,7 +321,7 @@ void MysqlDbConnection::DeactivateObject(const DbObject::Ptr& dbobj)
 }
 
 /* caller must hold m_ConnectionMutex */
-bool MysqlDbConnection::FieldToEscapedString(const String& key, const Value& value, Value *result)
+bool IdoMysqlDbConnection::FieldToEscapedString(const String& key, const Value& value, Value *result)
 {
        if (key == "instance_id") {
                *result = static_cast<long>(m_InstanceID);
@@ -372,7 +372,7 @@ bool MysqlDbConnection::FieldToEscapedString(const String& key, const Value& val
        return true;
 }
 
-void MysqlDbConnection::ExecuteQuery(const DbQuery& query)
+void IdoMysqlDbConnection::ExecuteQuery(const DbQuery& query)
 {
        boost::mutex::scoped_lock lock(m_ConnectionMutex);
 
similarity index 88%
rename from components/ido_mysql/mysqldbconnection.h
rename to components/ido_mysql/idomysqldbconnection.h
index 196dce320f7b186c3c066f4787821ef70ee36d5c..61fb8f593ad1227c0266ec1df3edef4636e96e74 100644 (file)
@@ -17,8 +17,8 @@
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#ifndef MYSQLDBCONNECTION_H
-#define MYSQLDBCONNECTION_H
+#ifndef IDOMYSQLDBCONNECTION_H
+#define IDOMYSQLDBCONNECTION_H
 
 #include "base/array.h"
 #include "base/dynamictype.h"
@@ -30,17 +30,17 @@ namespace icinga
 {
 
 /**
- * A MySQL database connection.
+ * An IDO MySQL database connection.
  *
  * @ingroup ido
  */
-class MysqlDbConnection : public DbConnection
+class IdoMysqlDbConnection : public DbConnection
 {
 public:
-       typedef shared_ptr<MysqlDbConnection> Ptr;
-       typedef weak_ptr<MysqlDbConnection> WeakPtr;
+       typedef shared_ptr<IdoMysqlDbConnection> Ptr;
+       typedef weak_ptr<IdoMysqlDbConnection> WeakPtr;
 
-       MysqlDbConnection(const Dictionary::Ptr& serializedUpdate);
+       IdoMysqlDbConnection(const Dictionary::Ptr& serializedUpdate);
        virtual void Stop(void);
 
        //virtual void UpdateObject(const DbObject::Ptr& dbobj, DbUpdateType kind);
@@ -85,4 +85,4 @@ private:
 
 }
 
-#endif /* MYSQLDBCONNECTION_H */
+#endif /* IDOMYSQLDBCONNECTION_H */