From 525214e66e18f46649186a016315f0ae8dfea1d4 Mon Sep 17 00:00:00 2001 From: silverqx Date: Tue, 23 Jul 2024 21:39:00 +0200 Subject: [PATCH] drivers bugfix withDefaultValues to false Changed the Default Column Values default argument value to false because Qt API doesn't obtain these Defaul Column Values in the QSqlQuery::record(), I didn't realize that. - updated functional tests --- drivers/common/include/orm/drivers/sqlquery.hpp | 6 +++--- .../drivers/sqlquery_normal/tst_sqlquery_normal.cpp | 8 ++++---- .../drivers/sqlquery_prepared/tst_sqlquery_prepared.cpp | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/common/include/orm/drivers/sqlquery.hpp b/drivers/common/include/orm/drivers/sqlquery.hpp index 0cde78371..6d9c46952 100644 --- a/drivers/common/include/orm/drivers/sqlquery.hpp +++ b/drivers/common/include/orm/drivers/sqlquery.hpp @@ -128,9 +128,9 @@ namespace MySql /* Result sets */ /*! Get a SqlRecord containing the field information for the current row. */ - SqlRecord record(bool withDefaultValues = true) const; + SqlRecord record(bool withDefaultValues = false) const; /*! Get a SqlRecord containing the field information for the current row. */ - const SqlRecord &recordCached(bool withDefaultValues = true) const; + const SqlRecord &recordCached(bool withDefaultValues = false) const; /*! Retrieve the next record and position the cursor on it. */ bool next(); @@ -193,7 +193,7 @@ namespace MySql /* Result sets */ #ifdef TINYDRIVERS_MYSQL_DRIVER /*! Get a SqlRecord containing the field information for the current row. */ - SqlRecord recordAllColumns(bool withDefaultValues = true) const; + SqlRecord recordAllColumns(bool withDefaultValues) const; #endif /*! Normal seek. */ diff --git a/tests/auto/functional/drivers/sqlquery_normal/tst_sqlquery_normal.cpp b/tests/auto/functional/drivers/sqlquery_normal/tst_sqlquery_normal.cpp index e64006ef4..6a6f7b991 100644 --- a/tests/auto/functional/drivers/sqlquery_normal/tst_sqlquery_normal.cpp +++ b/tests/auto/functional/drivers/sqlquery_normal/tst_sqlquery_normal.cpp @@ -472,8 +472,8 @@ void tst_SqlQuery_Normal::select_recordCached_WithDefaultValues() const while (torrents.next()) { QVERIFY(torrents.isValid()); - // Number of fields // Don't uncomment to test defaults - const auto &record = torrents.recordCached(/*true*/); + // Number of fields + const auto &record = torrents.recordCached(true); const auto recordCount = record.count(); QCOMPARE(recordCount, 7); @@ -672,8 +672,8 @@ void tst_SqlQuery_Normal::select_recordCached_WithoutDefaultValues() const while (torrents.next()) { QVERIFY(torrents.isValid()); - // Number of fields - const auto &record = torrents.recordCached(false); + // Number of fields // Don't uncomment to test the default argument + const auto &record = torrents.recordCached(/*false*/); const auto recordCount = record.count(); QCOMPARE(recordCount, 7); diff --git a/tests/auto/functional/drivers/sqlquery_prepared/tst_sqlquery_prepared.cpp b/tests/auto/functional/drivers/sqlquery_prepared/tst_sqlquery_prepared.cpp index d69d20c02..b9b2d7a4c 100644 --- a/tests/auto/functional/drivers/sqlquery_prepared/tst_sqlquery_prepared.cpp +++ b/tests/auto/functional/drivers/sqlquery_prepared/tst_sqlquery_prepared.cpp @@ -498,8 +498,8 @@ void tst_SqlQuery_Prepared::select_recordCached_WithDefaultValues() const while (torrents.next()) { QVERIFY(torrents.isValid()); - // Number of fields // Don't uncomment to test the default argument - const auto &record = torrents.recordCached(/*true*/); + // Number of fields + const auto &record = torrents.recordCached(true); const auto recordCount = record.count(); QCOMPARE(recordCount, 7); @@ -709,8 +709,8 @@ void tst_SqlQuery_Prepared::select_recordCached_WithoutDefaultValues() const while (torrents.next()) { QVERIFY(torrents.isValid()); - // Number of fields - const auto &record = torrents.recordCached(false); + // Number of fields // Don't uncomment to test the default argument + const auto &record = torrents.recordCached(/*false*/); const auto recordCount = record.count(); QCOMPARE(recordCount, 7);