summaryrefslogtreecommitdiffstats
path: root/src/qtbase-1.patch
blob: 97b794384e2c05927beae18db728d024ceceff10 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
This file is part of MXE.
See index.html for further information.

From e5939294f82e7e337f517fead6d4d14ecde5ee24 Mon Sep 17 00:00:00 2001
From: Tobias Koenig <tobias.koenig.qnx@kdab.com>
Date: Wed, 27 Nov 2013 13:11:01 +0100
Subject: [PATCH 1/5] Fix sub-second handling in SQLite driver

Use explicit format string, that contains milliseconds, when
converting an QDateTime/QTime to a SQLite field content.

Task-number: QTBUG-24200
[ChangeLog][QtSql][QSQLITE] Fix sub-second handling
Change-Id: Ib89152b7c3dd780b57a8826beff8b6b118e9d3d6
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Mark Brand <mabrand@mabrand.nl>

(cherry picked from commit 9e64fc9e1cebf1e11694c4f536881128f5aee288)

diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp
index 0a8b71a..27bc80e 100644
--- a/src/sql/drivers/sqlite/qsql_sqlite.cpp
+++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp
@@ -42,6 +42,7 @@
 #include "qsql_sqlite_p.h"
 
 #include <qcoreapplication.h>
+#include <qdatetime.h>
 #include <qvariant.h>
 #include <qsqlerror.h>
 #include <qsqlfield.h>
@@ -447,6 +448,20 @@ bool QSQLiteResult::exec()
                 case QVariant::LongLong:
                     res = sqlite3_bind_int64(d->stmt, i + 1, value.toLongLong());
                     break;
+                case QVariant::DateTime: {
+                    const QDateTime dateTime = value.toDateTime();
+                    const QString str = dateTime.toString(QStringLiteral("yyyy-MM-ddThh:mm:ss.zzz"));
+                    res = sqlite3_bind_text16(d->stmt, i + 1, str.utf16(),
+                                              str.size() * sizeof(ushort), SQLITE_TRANSIENT);
+                    break;
+                }
+                case QVariant::Time: {
+                    const QTime time = value.toTime();
+                    const QString str = time.toString(QStringLiteral("hh:mm:ss.zzz"));
+                    res = sqlite3_bind_text16(d->stmt, i + 1, str.utf16(),
+                                              str.size() * sizeof(ushort), SQLITE_TRANSIENT);
+                    break;
+                }
                 case QVariant::String: {
                     // lifetime of string == lifetime of its qvariant
                     const QString *str = static_cast<const QString*>(value.constData());
-- 
1.8.4


From 0c5dcbce26413ee17e052d79f348c35b4f963842 Mon Sep 17 00:00:00 2001
From: Tobias Koenig <tobias.koenig.qnx@kdab.com>
Date: Sat, 30 Nov 2013 14:40:11 +0100
Subject: [PATCH 2/5] Fix evaluation of SQLite driver options

Ensure that the options, which are passed to the SQLite driver, are
evaluated in the correct order and do not overwrite each other.
According to http://www.sqlite.org/c3ref/open.html the
SQLITE_OPEN_READONLY and (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE) are
mutual exclusive, but SQLITE_OPEN_URI can be combined with both of them.

Task-number: QTBUG-35186
[ChangeLog][QtSql][QSQLITE] Fixed evaluation of driver options
Change-Id: I8e74fe1ce43b9118b15f7b13fc71670bdcd73f68
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Mark Brand <mabrand@mabrand.nl>

(cherry picked from commit 4f28464ab7dfe9f18cd72fc022257e66a8e2b279)

diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp
index 27bc80e..c98d643 100644
--- a/src/sql/drivers/sqlite/qsql_sqlite.cpp
+++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp
@@ -599,24 +599,32 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c
 
     if (db.isEmpty())
         return false;
+
+    int timeOut = 5000;
     bool sharedCache = false;
-    int openMode = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, timeOut=5000;
-    QStringList opts=QString(conOpts).remove(QLatin1Char(' ')).split(QLatin1Char(';'));
-    foreach(const QString &option, opts) {
+    bool openReadOnlyOption = false;
+    bool openUriOption = false;
+
+    const QStringList opts = QString(conOpts).remove(QLatin1Char(' ')).split(QLatin1Char(';'));
+    foreach (const QString &option, opts) {
         if (option.startsWith(QLatin1String("QSQLITE_BUSY_TIMEOUT="))) {
             bool ok;
-            int nt = option.mid(21).toInt(&ok);
+            const int nt = option.mid(21).toInt(&ok);
             if (ok)
                 timeOut = nt;
-        }
-        if (option == QLatin1String("QSQLITE_OPEN_READONLY"))
-            openMode = SQLITE_OPEN_READONLY;
-        if (option == QLatin1String("QSQLITE_OPEN_URI"))
-            openMode |= SQLITE_OPEN_URI;
-        if (option == QLatin1String("QSQLITE_ENABLE_SHARED_CACHE"))
+        } else if (option == QLatin1String("QSQLITE_OPEN_READONLY")) {
+            openReadOnlyOption = true;
+        } else if (option == QLatin1String("QSQLITE_OPEN_URI")) {
+            openUriOption = true;
+        } else if (option == QLatin1String("QSQLITE_ENABLE_SHARED_CACHE")) {
             sharedCache = true;
+        }
     }
 
+    int openMode = (openReadOnlyOption ? SQLITE_OPEN_READONLY : (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE));
+    if (openUriOption)
+        openMode |= SQLITE_OPEN_URI;
+
     sqlite3_enable_shared_cache(sharedCache);
 
     if (sqlite3_open_v2(db.toUtf8().constData(), &d->access, openMode, NULL) == SQLITE_OK) {
-- 
1.8.4


From 4f829b92caae3ff877215b118b6c733714a74ab6 Mon Sep 17 00:00:00 2001
From: Nicolas Cornu <ncornu@aldebaran-robotics.com>
Date: Thu, 28 Nov 2013 00:06:41 +0100
Subject: [PATCH 3/5] Allow temporary databases in sqlite driver

http://www3.sqlite.org/inmemorydb.html#temp_db
[ChangeLog][QtSql][QSQLITE] Enable creating temporary databases

Change-Id: I9972fba5c91eca55cfc5a84f94cff03d19992324
Reviewed-by: Tobias Koenig <tobias.koenig.qnx@kdab.com>
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
(cherry picked from commit 9de879c8a43a012254036d7f08b55793fa325cb2)

diff --git a/src/sql/doc/src/sql-driver.qdoc b/src/sql/doc/src/sql-driver.qdoc
index d8d1058..82dfa27 100644
--- a/src/sql/doc/src/sql-driver.qdoc
+++ b/src/sql/doc/src/sql-driver.qdoc
@@ -599,8 +599,8 @@
     is not necessary to have a database server. SQLite operates on a
     single file, which must be set as the database name when opening
     a connection. If the file does not exist, SQLite will try to
-    create it. SQLite also supports in-memory databases, simply pass
-    ":memory:" as the database name.
+    create it. SQLite also supports in-memory and temporary databases. Simply
+    pass respectively ":memory:" or an empty string as the database name.
 
     SQLite has some restrictions regarding multiple users and
     multiple transactions. If you try to read/write on a resource from different
diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp
index c98d643..55ef092 100644
--- a/src/sql/drivers/sqlite/qsql_sqlite.cpp
+++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp
@@ -597,9 +597,6 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c
     if (isOpen())
         close();
 
-    if (db.isEmpty())
-        return false;
-
     int timeOut = 5000;
     bool sharedCache = false;
     bool openReadOnlyOption = false;
-- 
1.8.4


From 4222a7935ba386e296a0c24a56777de11b74bd75 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Tue, 26 Feb 2013 13:23:33 +0100
Subject: [PATCH 4/5] use pkg-config for freetype

Change-Id: Id2f78ed9dbdcacd570eb25982cbd700d0437542a

diff --git a/src/platformsupport/fontdatabases/basic/basic.pri b/src/platformsupport/fontdatabases/basic/basic.pri
index 88be809..8fc19d2 100644
--- a/src/platformsupport/fontdatabases/basic/basic.pri
+++ b/src/platformsupport/fontdatabases/basic/basic.pri
@@ -82,5 +82,7 @@ contains(QT_CONFIG, freetype) {
 } else:contains(QT_CONFIG, system-freetype) {
     # pull in the proper freetype2 include directory
     include($$QT_SOURCE_TREE/config.tests/unix/freetype/freetype.pri)
+    CONFIG += link_pkgconfig
+    PKGCONFIG += freetype2
 }
 
-- 
1.8.4


From a9ed072cf46c2f23de4c7c4b7d706ea335b6a775 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Sat, 18 May 2013 23:07:46 +0200
Subject: [PATCH 5/5] use pkgconfig for icu detection (MXE specific)

Change-Id: I874171361fec812cb5a5a56e4d8d90a630be3bf3

diff --git a/config.tests/unix/icu/icu.pro b/config.tests/unix/icu/icu.pro
index 2c1b431..e29798b 100644
--- a/config.tests/unix/icu/icu.pro
+++ b/config.tests/unix/icu/icu.pro
@@ -1,16 +1,5 @@
 SOURCES = icu.cpp
 CONFIG += console
 CONFIG -= qt dylib
-win32 {
-    CONFIG(static, static|shared) {
-        CONFIG(debug, debug|release) {
-            LIBS += -lsicuind -lsicuucd -lsicudtd
-        } else {
-            LIBS += -lsicuin -lsicuuc -lsicudt
-        }
-    } else {
-        LIBS += -licuin -licuuc
-    }
-} else {
-    LIBS += -licui18n -licuuc
-}
+CONFIG += link_pkgconfig
+PKGCONFIG += icu-i18n
-- 
1.8.4