summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Praden <florian@praden.eu>2015-02-02 15:25:24 +0100
committerAttila Molnar <attilamolnar@hush.com>2015-02-06 00:08:52 +0100
commitb3bafc6aaee4b6b95c6aaefcc6f2e80eca6bd370 (patch)
treefa37f40ba170d9071967b61ec49c0cedcd96af5f
parent0ec19b7ac91eedc83b31c3da733e237bfe28fc48 (diff)
m_mysql Add charset config option
-rw-r--r--src/modules/extra/m_mysql.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp
index 1cb3635bb..d8dda27a4 100644
--- a/src/modules/extra/m_mysql.cpp
+++ b/src/modules/extra/m_mysql.cpp
@@ -255,6 +255,12 @@ class SQLConnection : public SQLProvider
bool rv = mysql_real_connect(connection, host.c_str(), user.c_str(), pass.c_str(), dbname.c_str(), port, NULL, 0);
if (!rv)
return rv;
+
+ // Enable character set settings
+ std::string charset = config->getString("charset");
+ if ((!charset.empty()) && (mysql_set_character_set(connection, charset.c_str())))
+ ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "WARNING: Could not set character set to \"%s\"", charset.c_str());
+
std::string initquery;
if (config->readString("initialquery", initquery))
{