blob: c26d3d993b2bd6d51d1db0c18478cccb15f88918 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
From 8b8db29d10b2ef92deb2d87ff613f3d7f39af34e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Vr=C3=A1til?= <dvratil@kde.org>
Date: Fri, 26 Jul 2019 13:31:58 +0200
Subject: Fix compatibility with QMYSQL driver after 74aed95
Summary:
QPSQL requires the table name passed to QSqlDatabase::record() to be lowercase
since Qt 5.13, but doing that breaks QMYSQL, so only adjust the name when
using QPSQL.
CCBUG: 409234
Reviewers: #kde_pim, vkrause
Reviewed By: #kde_pim, vkrause
Subscribers: kde-pim
Tags: #kde_pim
Differential Revision: https://phabricator.kde.org/D22677
---
src/server/storage/dbintrospector.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/server/storage/dbintrospector.cpp b/src/server/storage/dbintrospector.cpp
index 70d952a..932444c 100644
--- a/src/server/storage/dbintrospector.cpp
+++ b/src/server/storage/dbintrospector.cpp
@@ -76,7 +76,10 @@ bool DbIntrospector::hasColumn(const QString &tableName, const QString &columnNa
QStringList columns = m_columnCache.value(tableName);
if (columns.isEmpty()) {
- const QSqlRecord table = m_database.record(tableName.toLower());
+ // QPSQL requires the name to be lower case, but it breaks compatibility with existing
+ // tables with other drivers (see BKO#409234). Yay for abstraction...
+ const auto name = (DbType::type(m_database) == DbType::PostgreSQL) ? tableName.toLower() : tableName;
+ const QSqlRecord table = m_database.record(name);
const int numTables = table.count();
columns.reserve(numTables);
for (int i = 0; i < numTables; ++i) {
--
cgit v1.1
|