summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamas Bunth <tamas.bunth@collabora.co.uk>2019-09-05 14:31:35 +0200
committerTamás Bunth <btomi96@gmail.com>2019-09-06 16:05:01 +0200
commitcc876706b1626078ee056c35f7dda1efcc315df9 (patch)
treefd58910940516dfd2ed9d6caac7b1f33b34c8ee6
parent9219242d42b7b0e5b00d7a1997cc7fcf35894627 (diff)
mysqlc: Support connection to utf8mb4 server
This charset is backward compatible with 'normal' utf-8. Change-Id: I4407894bf9029b9c56eb0d2530796e85bd226591 Reviewed-on: https://gerrit.libreoffice.org/78650 Tested-by: Jenkins Reviewed-by: Tamás Bunth <btomi96@gmail.com>
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_connection.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
index a9d4438dfa97..48cc6aca3a00 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
@@ -88,6 +88,8 @@ void OConnection::construct(const OUString& url, const Sequence<PropertyValue>&
// use TCP as connection
mysql_protocol_type protocol = MYSQL_PROTOCOL_TCP;
mysql_options(&m_mysql, MYSQL_OPT_PROTOCOL, &protocol);
+ OString charset_name{ "utf8mb4" };
+ mysql_options(&m_mysql, MYSQL_SET_CHARSET_NAME, charset_name.getStr());
sal_Int32 nIndex;
OUString token;
@@ -198,7 +200,7 @@ void OConnection::construct(const OUString& url, const Sequence<PropertyValue>&
lcl_executeUpdate(&m_mysql,
OString{ "SET session sql_mode='ANSI_QUOTES,NO_AUTO_VALUE_ON_ZERO'" });
- lcl_executeUpdate(&m_mysql, OString{ "SET NAMES utf8" });
+ lcl_executeUpdate(&m_mysql, OString{ "SET NAMES utf8mb4" });
}
OUString OConnection::getImplementationName()