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

New commits:
commit 2454cbd3d810679b0703b0764abf2d05b01c89e7
Author:     Tamas Bunth <tamas.bu...@collabora.co.uk>
AuthorDate: Thu Sep 5 14:31:35 2019 +0200
Commit:     Tamás Bunth <btom...@gmail.com>
CommitDate: Sat Sep 7 10:30:13 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/78654
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Tamás Bunth <btom...@gmail.com>

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

Reply via email to