]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/extra/m_mysql.cpp
Merge branch 'master+gnutlsprio'
[user/henk/code/inspircd.git] / src / modules / extra / m_mysql.cpp
index 1002a98ba9129beb54ec8262d8aa9095e1058503..d8dda27a4ef6c91cb4d609f32e8ddfe97ea707ec 100644 (file)
@@ -89,7 +89,7 @@ struct RQueueItem
        RQueueItem(SQLQuery* Q, MySQLresult* R) : q(Q), r(R) {}
 };
 
-typedef std::map<std::string, SQLConnection*> ConnMap;
+typedef insp::flat_map<std::string, SQLConnection*> ConnMap;
 typedef std::deque<QQueueItem> QueryQueue;
 typedef std::deque<RQueueItem> ResultQueue;
 
@@ -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))
                {