gnucash maint: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Sun Feb 7 17:19:37 EST 2021


Updated	 via  https://github.com/Gnucash/gnucash/commit/ba0e4128 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/fe4f9ed6 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/9386b276 (commit)
	from  https://github.com/Gnucash/gnucash/commit/fa1be8f3 (commit)



commit ba0e412815e712d4daf8100d0bc157f81f361701
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Feb 7 13:45:59 2021 -0800

    Bug 798112 - An error occurred while processing mysql ...
    
    A "Feature" of MYSQL is that it allows C-style backslash escapes
    in string constants and replaces them with the actual character
    (e.g. \n is converted to 0x0a). This causes round trip problems
    if the escape is one of the allowed ones and a MYSQL error if it
    isn't.
    
    Disable the feature so that MYSQL follows the SQL standard.

diff --git a/libgnucash/backend/dbi/gnc-backend-dbi.cpp b/libgnucash/backend/dbi/gnc-backend-dbi.cpp
index fdb7a3357..0c9fae77a 100644
--- a/libgnucash/backend/dbi/gnc-backend-dbi.cpp
+++ b/libgnucash/backend/dbi/gnc-backend-dbi.cpp
@@ -571,12 +571,21 @@ adjust_sql_options (dbi_conn connection)
         return;
     }
     PINFO("Initial sql_mode: %s", str.c_str());
-    if(str.find(SQL_OPTION_TO_REMOVE) == std::string::npos)
-        return;
+    if(str.find(SQL_OPTION_TO_REMOVE) != std::string::npos)
+        str = adjust_sql_options_string(str);
+
+    //https://bugs.gnucash.org/show_bug.cgi?id=798112
+    const char* backslash_option{"NO_BACKSLASH_ESCAPES"};
+
+    if (str.find(backslash_option) == std::string::npos)
+    {
+        if (!str.empty())
+            str.append(",");
+        str.append(backslash_option);
+    }
 
-    std::string adjusted_str{adjust_sql_options_string(str)};
-    PINFO("Setting sql_mode to %s", adjusted_str.c_str());
-    std::string set_str{"SET sql_mode='" + std::move(adjusted_str) + "'"};
+    PINFO("Setting sql_mode to %s", str.c_str());
+    std::string set_str{"SET sql_mode='" + std::move(str) + "'"};
     dbi_result set_result = dbi_conn_query(connection,
                                            set_str.c_str());
     if (set_result)

commit fe4f9ed64ab84ed19db2c2bf520c29b399ad70e4
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Feb 5 15:05:29 2021 -0800

    [test-backend-dbi] Fix copying hidden property.
    
    So that it actually copies it to the *other* root account.

diff --git a/libgnucash/backend/dbi/test/test-dbi-stuff.cpp b/libgnucash/backend/dbi/test/test-dbi-stuff.cpp
index ac59f9dcb..9bfecada3 100644
--- a/libgnucash/backend/dbi/test/test-dbi-stuff.cpp
+++ b/libgnucash/backend/dbi/test/test-dbi-stuff.cpp
@@ -68,7 +68,7 @@ compare_account_trees (QofBook* book_1, QofBook* book_2)
     Account* root_1 = gnc_book_get_root_account (book_1);
     Account* root_2 = gnc_book_get_root_account (book_2);
 
-    xaccAccountSetHidden (root_1, xaccAccountGetHidden (root_1));
+    xaccAccountSetHidden (root_2, xaccAccountGetHidden (root_1));
     g_assert (xaccAccountEqual (root_1, root_2, FALSE));
 }
 

commit 9386b276e5faaf692b33e757f86acbdbf8eb2f5c
Author: Micha Lenk <micha at lenk.info>
Date:   Sat Jan 16 15:30:07 2021 +0100

    Make prototypes static for autoclear unit test
    
    With the explicit prototypes not marked as static unit test builds on Debian
    Buster (using buster-backports) fail with
    
    error: testing::internal::ParamGenerator<TestCase*> gtest_InstantiationAutoClearTestAutoClearTest_EvalGenerator_() was declared extern and later static [-fpermissive]
    
    According to the comment preceding the declaration the only intent of the
    explicit prototype (in newer versions of googletest implicitly defined by the
    GTEST macros) seems to be to silence a warning which would cause a build
    failure on Ubuntu 18.04 when using -Werror.
    
    Builds on Debian unstable seem to build just fine without this explicit
    declaration, hence I consider it safe to just drop it. However, builds on
    Ubuntu 18.04 then fail (see above).
    
    Making the prototypes as static should make both build environments happy.

diff --git a/libgnucash/app-utils/test/test-autoclear.cpp b/libgnucash/app-utils/test/test-autoclear.cpp
index abb84e1c5..92b6d7404 100644
--- a/libgnucash/app-utils/test/test-autoclear.cpp
+++ b/libgnucash/app-utils/test/test-autoclear.cpp
@@ -157,9 +157,9 @@ TEST_P(AutoClearTest, DoesAutoClear) {
 }
 
 #ifndef INSTANTIATE_TEST_SUITE_P
-// Silence "no previous declaration for" which is treated as error, due to -Werror
-testing::internal::ParamGenerator<TestCase*> gtest_InstantiationAutoClearTestAutoClearTest_EvalGenerator_();
-std::string gtest_InstantiationAutoClearTestAutoClearTest_EvalGenerateName_(const testing::TestParamInfo<TestCase*>&);
+// Silence "no previous declaration for" (treated as error due to -Werror) when building with GoogleTest < 1.8.1
+static testing::internal::ParamGenerator<TestCase*> gtest_InstantiationAutoClearTestAutoClearTest_EvalGenerator_();
+static std::string gtest_InstantiationAutoClearTestAutoClearTest_EvalGenerateName_(const testing::TestParamInfo<TestCase*>&);
 
 INSTANTIATE_TEST_CASE_P(
 #else // INSTANTIATE_TEST_SUITE_P



Summary of changes:
 libgnucash/app-utils/test/test-autoclear.cpp   |  6 +++---
 libgnucash/backend/dbi/gnc-backend-dbi.cpp     | 19 ++++++++++++++-----
 libgnucash/backend/dbi/test/test-dbi-stuff.cpp |  2 +-
 3 files changed, 18 insertions(+), 9 deletions(-)



More information about the gnucash-changes mailing list