diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-02 00:50:58 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-02 00:50:58 +0000 |
commit | 972edd0ff3b6750d270b79407cc8407c413d2082 (patch) | |
tree | 78ff145637fc2c3e2878c537c4a6702ae58a99e7 | |
parent | bbaf9002a8cf427b2cbe93fd34a112e3d5f445ac (diff) |
Add initial query support to m_mysql [patch by Athenon]
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11642 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/modules/extra/m_mysql.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index 06c2a13b6..cff09d9b4 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -305,6 +305,7 @@ class SQLConnection : public classbase std::map<std::string,std::string> thisrow; bool Enabled; ModuleSQL* Parent; + std::string initquery; public: @@ -336,6 +337,9 @@ class SQLConnection : public classbase if (!CheckConnection()) return; + if( !initquery.empty() ) + mysql_query(connection,initquery.c_str()); + /* Parse the command string and dispatch it to mysql */ SQLrequest& req = queue.front(); @@ -507,6 +511,11 @@ class SQLConnection : public classbase return host.host; } + void setInitialQuery(std::string init) + { + initquery = init; + } + void SetEnable(bool Enable) { Enabled = Enable; @@ -617,6 +626,7 @@ void LoadDatabases(ConfigReader* conf, InspIRCd* ServerInstance, ModuleSQL* Pare host.user = conf->ReadValue("database", "username", j); host.pass = conf->ReadValue("database", "password", j); host.ssl = conf->ReadFlag("database", "ssl", j); + std::string initquery = conf->ReadValue("database", "initialquery", j); if (HasHost(host)) continue; @@ -625,6 +635,8 @@ void LoadDatabases(ConfigReader* conf, InspIRCd* ServerInstance, ModuleSQL* Pare { SQLConnection* ThisSQL = new SQLConnection(host, Parent); Connections[host.id] = ThisSQL; + + ThisSQL->setInitialQuery(initquery); } } ConnectDatabases(ServerInstance, Parent); |