summaryrefslogtreecommitdiffstats
path: root/src/sql/kernel/qsqldatabase.cpp
diff options
context:
space:
mode:
authorThiago Macieira <[email protected]>2025-01-26 10:04:21 -0800
committerThiago Macieira <[email protected]>2025-02-07 18:46:38 -0800
commit16aae5a4b83517e302e5c14ce07c8f210b308ad8 (patch)
treedb0c2b2e923110e85e64ba3cc5fc0184eb4bcc28 /src/sql/kernel/qsqldatabase.cpp
parent03f6f176b1ef789ae8320da13a37d3590918694f (diff)
QSqlDatabase: fix historical mistake of defaultConnection being non-const
This was likely never intended, and was a mistake in the API design, missing the second const after the pointer. It should have been: static const char *const defaultConnection; This commit fixes that mistake by replacing the variable with a constexpr one that can't be modified. We can actually do better by moving the name to the header, so it will get emitted in each library, application, or plugin instead of trying to load from QtSql. [ChangeLog][Potentially Source-Incompatible Changes] The static QSqlDatabase::connectionName member variable has changed from a non-const pointer to a constexpr array. Modifying the pointer was most likely a mistake in code and would produce a misbehaving application. Change-Id: Icf2eddc865c2d6dde0c7fffda06e55e215e5f26d Reviewed-by: Marc Mutz <[email protected]> Reviewed-by: Christian Ehrlicher <[email protected]>
Diffstat (limited to 'src/sql/kernel/qsqldatabase.cpp')
-rw-r--r--src/sql/kernel/qsqldatabase.cpp2
1 files changed, 0 insertions, 2 deletions
diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp
index 0a54529679e..bb7d5a1ea53 100644
--- a/src/sql/kernel/qsqldatabase.cpp
+++ b/src/sql/kernel/qsqldatabase.cpp
@@ -36,8 +36,6 @@ using namespace Qt::StringLiterals;
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
(QSqlDriverFactoryInterface_iid, "/sqldrivers"_L1))
-const char *QSqlDatabase::defaultConnection = "qt_sql_default_connection";
-
namespace {
struct QtSqlGlobals
{