summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/modules/extra/m_mysql.cpp12
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);