From 91a97c5e0b7b760ec0b46ad38b28ec1419c7d48f Mon Sep 17 00:00:00 2001 From: Tamas Bunth Date: Tue, 3 Sep 2019 15:29:55 +0200 Subject: tdf#127093 mysqlc: set NO_AUTO_VALUE_ON_ZERO MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without setting this sql_mode, NULL or 0 inserted to an auto-incremented column of a prepared statement would cause that to be auto generated. Setting NO_AUTO_VALUE_ON_ZERO allows us to copy/paste auto-incremented columns which may contain zero values as well. Change-Id: I9602746371c75c82c99ff63240025e8cfb03776a Reviewed-on: https://gerrit.libreoffice.org/78560 Tested-by: Jenkins Reviewed-by: Tamás Bunth --- connectivity/source/drivers/mysqlc/mysqlc_connection.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx index 193cc1c6ffe2..a9d4438dfa97 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx @@ -196,7 +196,8 @@ void OConnection::construct(const OUString& url, const Sequence& *this, OUString(), 0, Any()); } - lcl_executeUpdate(&m_mysql, OString{ "SET session sql_mode='ANSI_QUOTES'" }); + lcl_executeUpdate(&m_mysql, + OString{ "SET session sql_mode='ANSI_QUOTES,NO_AUTO_VALUE_ON_ZERO'" }); lcl_executeUpdate(&m_mysql, OString{ "SET NAMES utf8" }); } -- cgit