connectivity/source/drivers/mysqlc/mysqlc_connection.cxx |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 3598b74da8240190076f975fd7d1ff2b2d7d65dc
Author:     Tamas Bunth <tamas.bu...@collabora.co.uk>
AuthorDate: Thu Sep 5 14:31:35 2019 +0200
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Tue Sep 17 12:52:30 2019 +0200

    mysqlc: Support connection to utf8mb4 server
    
    This charset is backward compatible with 'normal' utf-8.
    
    Change-Id: I4407894bf9029b9c56eb0d2530796e85bd226591
    Reviewed-on: https://gerrit.libreoffice.org/78655
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
index 981fe7392aa5..0c40866dc3e6 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,8 +200,9 @@ void OConnection::construct(const OUString& url, const 
Sequence<PropertyValue>&
                            *this, OUString(), 0, Any());
     }
 
-    lcl_executeUpdate(&m_mysql, OString{ "SET session sql_mode='ANSI_QUOTES'" 
});
-    lcl_executeUpdate(&m_mysql, OString{ "SET NAMES utf8" });
+    lcl_executeUpdate(&m_mysql,
+                      OString{ "SET session 
sql_mode='ANSI_QUOTES,NO_AUTO_VALUE_ON_ZERO'" });
+    lcl_executeUpdate(&m_mysql, OString{ "SET NAMES utf8mb4" });
 }
 
 OUString OConnection::getImplementationName()
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to