2 more tries to force DB to respond in UTF8 (fixes #1599)

This commit is contained in:
def 2019-04-08 16:55:53 +02:00
parent a4e2130342
commit ea093f6d39

View file

@ -112,6 +112,7 @@ bool CSqlServer::Connect()
connection_properties["OPT_WRITE_TIMEOUT"] = 20; connection_properties["OPT_WRITE_TIMEOUT"] = 20;
connection_properties["OPT_RECONNECT"] = true; connection_properties["OPT_RECONNECT"] = true;
connection_properties["OPT_CHARSET_NAME"] = sql::SQLString("utf8mb4"); connection_properties["OPT_CHARSET_NAME"] = sql::SQLString("utf8mb4");
connection_properties["OPT_SET_CHARSET_NAME"] = sql::SQLString("utf8mb4");
// Create connection // Create connection
{ {
@ -123,6 +124,9 @@ bool CSqlServer::Connect()
// Create Statement // Create Statement
m_pStatement = m_pConnection->createStatement(); m_pStatement = m_pConnection->createStatement();
// Apparently OPT_CHARSET_NAME and OPT_SET_CHARSET_NAME are not enough
m_pStatement->execute("SET CHARACTER SET utf8mb4;");
if (m_SetUpDB) if (m_SetUpDB)
{ {
char aBuf[128]; char aBuf[128];