Commit Graph

216 Commits

Author SHA1 Message Date
Florian Bruhin
49efea26a5 sqlite: Fix QSqlError handling when opening/closing database
Both sqlite3_open_v2 and sqlite3_close are documented to return an error code:
https://www.sqlite.org/c3ref/open.html https://sqlite.org/c3ref/close.html

However, those were ignored (other than checking whether the operation
succeeded), causing QSqlError::nativeErrorCode() to always be "-1" when there
was an error while opening/closing the database.

Additionally, the error string needs to be read (via sqlite3_errmsg16) in
qMakeError *before* d->access is set to 0, or the databaseText() will always be
"out of memory" no matter what error actually happened.

Task-number: QTBUG-70506
Change-Id: I75cbf178c9711442e640afd26c4502214d20c598
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-09-13 18:18:47 +00:00
Andy Shaw
fce6303a35 Remove a reference to a no longer used database server
Task-number: QTBUG-32390
Change-Id: I7556507267be04ca50c4ad0c7d49f3aa5fe31a90
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
2018-05-16 14:40:19 +00:00
Andy Shaw
b0f3cc1594 sqlite: Allow for duplicated placeholders with just one placeholder
This accounts for a case of a placeholder being duplicated in the
prepare query, but where only one placeholder was used. This amends
e4e87a2ece

Task-number: QTBUG-68299
Change-Id: Ia92ee912facd51a13e7222886debb219b24442b0
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-05-16 11:42:25 +00:00
Andy Shaw
ec23d96c86 oci: Use OCIBindByPos2 to accommodate data longer than USHRT_MAX
OCIBindByPos2 is only needed when using execBatch(), binding data that
is longer than USHRT_MAX works for exec() so this is left unchanged.

Change-Id: Ifdcf91939d184f225d24c13052ea0b81611ecf91
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-04-06 12:44:37 +00:00
David Faure
e729ac6dc5 QSqlDatabase: Skip confusing thread warning on invalid QSqlDatabase
If the db isn't valid, then that's the actual issue, not the fact that we're
getting the same invalid db (with the same driver QSqlNullDriver) in
multiple threads.

Change-Id: I95490818ed78e741c3823e115f139c2cff01b0b1
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2018-04-06 07:18:03 +00:00
Andy Shaw
7775eb248a sqlite: Support using execBatch() with duplicated named placeholders
Also expands the tst_qsqlquery::batchExec() test to account for this
case and generally test the functionality. In addition it is made to be
more robust to avoid any discrepencies with the testing data. The test
in general is also cleaned up to enable more of it being tested with
the different database drivers where possible.

An expected fail is added for MySQL due to the fact that it has a bug
where null timestamp entries are being converted to the current
datetime when adding it as a bind value.

Change-Id: I0061bd1c69ae35b4858afc49420f13ce59cf48ae
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-03-27 16:50:19 +00:00
Andy Shaw
9b68dc19bf MySQL: Fix tests
This fixes the following:
  - tst_QSqlDatabase::recordMySQL() to account for performance
    improvements done for small integral types
  - tst_QSqlQuery::nextResult() so that NUMERIC results are seen
    as doubles
  - tst_QSqlQuery::timeStampParsing() so that MySQL accepts the
    CREATE TABLE statement

Change-Id: I68fb1d06dac12d500bb4596463f5bdd65cc9c226
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-03-17 23:14:34 +00:00
Andy Shaw
e4e87a2ece sqlite: Prevent a crash when sqlite does not detect any parameters
When using a virtual table inside a SQLite database it is possible that
it does not report the right number of parameters. Therefore we need
to account for this case to prevent it from crashing when trying to
bind parameters it thinks does not exist.

Task-number: QTBUG-66816
Change-Id: I3ff70bb1fe73091f43c3df53616f75858e451cfd
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-03-17 23:14:14 +00:00
Christian Ehrlicher
3185b40d5d SQL/Postgres: Fix support for nan, inf and -inf
Postgresql needs a special value for nan and +/- inf. This was
considered during insert but not during select.
Also remove some pre-c++11 inf/nan - handling and replace it with
Qt equivalents.

Change-Id: I044ca58e9cf673f4b100b05a0d8e25c8a9c29ec5
Reviewed-by: Robert Szefner <robertsz27@interia.pl>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2018-03-07 18:35:57 +00:00
Andy Shaw
8635ad1b59 psql: Add expected failures where the table name is case sensitive
Currently there is a bug in Qt regarding the PostgreSQL driver as it
does not correctly escape the table names when constructing queries
internally. Therefore, these tests are marked as expected failures until
the bug itself is fixed in Qt.

Change-Id: I74dadc187f8a08509128dfea27be99787e57ea51
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-02-21 07:07:26 +00:00
Andy Shaw
a245c312b8 psql: Fix SQL tests
This also accounts for some quirks on the PostgreSQL side:
 - Null values for a related table are placed in a different
   order when sorted.
 - Functions (sum, count) return a different type than other databases
 - Using quotes to account for case sensitivity with tables

Task-number: QTBUG-63861
Change-Id: Ib1894fa8d0c77d7045941f7c57be0d0acd8d117e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-02-20 15:20:54 +00:00
Liang Qi
48577b2e7f Merge remote-tracking branch 'origin/5.10.1' into 5.11
Conflicts:
	src/plugins/sqldrivers/psql/qsql_psql.cpp

Change-Id: I070b455078b41e75c46562fcea5676d6218cd00c
2018-02-19 16:02:52 +01:00
Andy Shaw
6c6ace9d23 psql: Improve performance of record()
In order to save having to always run a query to get the tablename for
a known oid then we cache the result on the driver side. The oid stays
the same while the table exists, so only on dropping it would it change.
Recreating the table causes it to get a new oid, so there is no risk of
the old one being associated with the wrong table when this happens, if
the driver is still open at that point.

The benchmark added shows the improvement from the previous code, before
the results for PostgreSQL was:

RESULT : tst_QSqlRecord::benchmarkRecord():"0_QPSQL@localhost":
     259 msecs per iteration (total: 259, iterations: 1)

whereas now it is:

RESULT : tst_QSqlRecord::benchmarkRecord():"0_QPSQL@localhost":
     0.000014 msecs per iteration (total: 59, iterations: 4194304)

Task-number: QTBUG-65226
Change-Id: Ic290cff719102743da84e2044cd23e540f20c96c
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Robert Szefner <robertsz27@interia.pl>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-02-08 18:24:48 +00:00
Andy Shaw
e4fc098a53 Make it easier to specify test databases on a per system level
Instead of having to modify the tst_databases.h file whenever you want
to add a test database, this will now read from a file to find what
databases are available. This defaults to dbs.json in the same directory
or the QT_TEST_DATABASES_FILE environment variable can be set to point
to the file that contains the databases. The latter makes it easier for
CI then to have something set up on a per configuration basis.

The SQLite database stays hardcoded so this will continue to be tested as
before without any additional changes.

Change-Id: I7e7ccde6a6be3e490dd640b1590e3b691a6b2ab3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2018-01-26 11:33:07 +00:00
Liang Qi
f4d8cafc1b Merge remote-tracking branch 'origin/5.10' into dev
Conflicts:
	src/3rdparty/harfbuzz-ng/src/hb-private.hh
	src/sql/doc/snippets/code/doc_src_sql-driver.cpp
	src/sql/doc/src/sql-driver.qdoc

Change-Id: I38f0e82fcd37926cbf3c1915e009a731040d4598
2018-01-11 18:10:41 +01:00
Andy Shaw
3e58f2b090 sqlite: Bind duplicated named placeholders correctly
sqlite will reuse the index for bound parameters when the named
placeholder is duplicated so we only need to call bind one time for each
placeholder. Therefore we need to have just one instance of each value
when doing the bind.

Task-number: QTBUG-65150
Change-Id: I75c4bcc4563e43c180a59a7a4cbb770dbe994642
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
2018-01-08 10:13:10 +00:00
Robert Szefner
6d0c8825f9 QPSQL: Add support for multiple result sets
This change adds support for multiple result sets in PostgreSQL.

[Important Behavior Changes] The QPSQL driver now supports multiple
result sets. Since QPSQL previously did not support multiple result
sets, there may be some compatibility issues with the existing code
that executed several queries as one and were expecting to get
the results of the last one. In this case use QSqlQuery::nextResult()
to move to the last result set.

[ChangeLog][QtSql][QPSQL] Added support for multiple result sets

Change-Id: I2bfc91f512c4dac83116f3aa42833839a6da084c
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2018-01-08 09:10:10 +00:00
Robert Szefner
f99d2b21b8 QPSQL: Add support for forward-only queries
With this change, it is possible to significantly reduce memory
consumption of applications that fetch large result sets from databases.
The implementation is based on the new functionality called "single-row
mode" that was introduced in PostgreSQL version 9.2:

https://www.postgresql.org/docs/9.2/static/libpq-async.html

It also uses asynchronous commands PQsendQuery(), PQgetResult():

https://www.postgresql.org/docs/9.2/static/libpq-single-row-mode.html

[ChangeLog][QtSql][QPSQL] Added support for forward-only queries (requires
libpq version 9.2 or later)

[Important Behavior Changes] The QPSQL driver now supports forward-only
queries. To use this feature, you must build QPSQL plugin with PostreSQL
client library version 9.2 or later. See the Qt SQL documentation for
more information about QPSQL limitations of forward-only queries
(sql-driver.html).

[Important Behavior Changes] If you build the QPSQL plugin with PostgreSQL
version 9.2 or later, then you must distribute your application with
libpq version 9.2 or later. Otherwise, the QPSQL plugin will fail to load.

Task-number: QTBUG-63714
Change-Id: I15db8c8fd664f2a1f719329f5d113511fa69010c
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-01-06 08:24:32 +00:00
Andy Shaw
fa1397882a Test calling setRelation() with QSqlRelation() clears the relation
Change-Id: I93dbec54bfb9402b9044323862c2ae1d41e1790a
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
2018-01-02 08:50:54 +00:00
Andy Shaw
9b361f0e90 Return an invalid QSqlDatabase when accessing from another thread
QSqlDatabase objects can only be used in the thread that the connection
was opened for. So if the driver was created already then we check if
the thread is correct. If it is not then we output a warning and return
an invalid QSqlDatabase.

[ChangeLog][QtSql][QSqlDatabase] QSqlDatabase::database() will return
an invalid QSqlDatabase if the calling thread does not own the requested
QSqlDatabase.

Task-number: QTBUG-216
Change-Id: Ib5a25aa62129e3925f9819109af05961e5178bc5
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-01-02 08:49:40 +00:00
Andy Shaw
c4ba2b1c70 Copy the numericalPrecisionPolicy when copying the QSqlDatabase
As the numercialPrecisionPolicy can be set and subsequently retrieved
from the QSqlDatabase's driver, then when copying the QSqlDatabase, we
need to set that appropriately too.

Task-number: QTBUG-10452
Change-Id: I2c63748365ab4e9fbc29d8d460d80d2e2a0ee385
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-12-01 10:52:44 +00:00
Andy Shaw
33b03d99cd Remove code that refers to PostgreSQL 7.2 or older
We haven't had support for anything older than 7.3 for a long time, so
this removes the code to save having to maintain it any further.

Task-number: QTBUG-644
Change-Id: If0635f3bef5138a00a0e77011a70f23d0bffda32
Reviewed-by: Robert Szefner <robertsz27@interia.pl>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-12-01 10:52:32 +00:00
Liang Qi
153e8b49ad Merge remote-tracking branch 'origin/5.10' into dev
Conflicts:
	src/network/access/qhttp2protocolhandler_p.h
	src/network/kernel/kernel.pri
	src/network/ssl/qsslkey_qt.cpp
	src/plugins/platforms/cocoa/qcocoascreen.mm
	src/plugins/platforms/windows/accessible/iaccessible2.cpp
	src/plugins/platforms/windows/accessible/iaccessible2.h
	src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp
	src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
	src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h
	src/widgets/widgets/qmenu_p.h
	tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
	tests/auto/other/qaccessibility/tst_qaccessibility.cpp
	tests/auto/testlib/selftests/expected_cmptest.lightxml
	tests/auto/testlib/selftests/expected_cmptest.teamcity
	tests/auto/testlib/selftests/expected_cmptest.txt
	tests/auto/testlib/selftests/expected_cmptest.xml

Done-with: Edward Welbourne <edward.welbourne@qt.io>
Change-Id: I4217cc7d840cbae3e3dd28574741544469c4c6b9
2017-11-23 09:36:03 +01:00
Liang Qi
c4885b21d6 Merge remote-tracking branch 'origin/5.9' into 5.10
Also blacklist tst_QNetworkReply::ioHttpRedirectErrors(too-many-redirects)
on RHEL 6.6 in CI.

 Conflicts:
	tests/auto/network/access/qnetworkreply/BLACKLIST
	tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp

Task-number: QTBUG-64569
Change-Id: I7514fc0660c18fd3a3e1d0d0af3f15d879e3c6f4
2017-11-17 08:59:14 +01:00
Andy Shaw
3dab19ffed OCI: Match the constraints on the index_name column
When looking for the primary index, it is possible that the
constraint_name in the all_ind_columns table does not match that of the
index_name. Whereas the index_name will match in this case, so the query
should set the where clause on the index_name in both tables.

Task-number: QTBUG-64427
Change-Id: I1bf1fb580e620b9f75f2fde1ecf408842e377365
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
2017-11-15 06:40:45 +00:00
Liang Qi
88cf044580 Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
	src/gui/kernel/qwindow.cpp
	src/plugins/platforms/cocoa/qcocoawindow.mm
	src/plugins/platforms/windows/qwindowssystemtrayicon.cpp
	src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
	tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
	tests/auto/widgets/kernel/qaction/tst_qaction.cpp

Change-Id: Ifa515dc0ece7eb1471b00c1214149629a7e6a233
2017-11-09 11:47:57 +01:00
Robert Szefner
429d5f0c5e Set correct datatype for column 'more_data' in PostgreSQL
Task-number: QTBUG-63861
Change-Id: Ice9e788841046482bf5c4653eb859d00bc6b1c59
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2017-11-08 23:19:39 +00:00
Robert Szefner
0445065645 Run oraArrayBind() test only for Oracle DBMS
This test contains Oracle specific queries and will fail for other DBMS.
Currently it doesn't fail, because it is skipped for drivers that doesn't
support BatchOperations and only QOCI supports batch operations.

Change-Id: I8f1e7c7244726fa11c841023dec186553747a6b5
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2017-11-06 17:03:18 +00:00
Liang Qi
17d5141113 Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
	src/plugins/platforms/windows/qwindowswindow.cpp
	tests/auto/widgets/kernel/qaction/tst_qaction.cpp

Change-Id: Ia017a825ed2ca2d53ac586f4ae48df6f65818d40
2017-10-30 08:54:05 +01:00
Robert Szefner
d1422da264 Fix psql_schemas test
Ignore case when comparing table names in PostgreSQL

Task-number: QTBUG-63861
Change-Id: Iaf56dff11ee79f96fd3b136e1576f2578328ac79
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-10-26 13:00:06 +00:00
Andy Shaw
0900cf3581 OCI: Use TIMESTAMP for datetime data
The TIMESTAMP type has been available in Oracle since Oracle 9i
which was released in June 2001 and contains more data than the
DATE type so it can be reliably used for the related data types.

This adds support for preserving milliseconds and the time zone
information if this is passed or in the database.

[ChangeLog][QtSql][OCI] Added support for the TIMESTAMP data type.

Task-number: QTBUG-23
Change-Id: Icf7a012dda75fb342ce6c6aa34eaa2a52755ff2d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-10-10 08:56:32 +00:00
Liang Qi
01bc69f99f Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
	src/plugins/styles/mac/qmacstyle_mac.mm
	src/widgets/util/qcompleter.cpp
	src/widgets/widgets/qmainwindowlayout.cpp
	src/widgets/widgets/qmdisubwindow.cpp

Change-Id: If0e96981af07ce36ac68f2e69211bc2120f93973
2017-09-20 11:58:32 +02:00
Andy Shaw
3c95c748e0 Fix recordOCI() test to treat clob/nclob as QByteArray
Change-Id: I0315b23dad66f98fc681c624d4afa8b5abb54a7b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-09-18 21:06:49 +00:00
Andy Shaw
2d168af7d7 OCI: Use correct type for getting doubles
Change-Id: Iffb81a37a517e58d48757d82f93f20e8c5100033
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-09-18 21:06:42 +00:00
Liang Qi
112a4af107 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	examples/examples.pro
	qmake/library/qmakebuiltins.cpp
	src/corelib/global/qglobal.cpp
		Re-apply b525ec2 to qrandom.cpp(code movement in 030782e)
	src/corelib/global/qnamespace.qdoc
	src/corelib/global/qrandom.cpp
	src/gui/kernel/qwindow.cpp
		Re-apply a3d59c7 to QWindowPrivate::setVisible() (code movement in d7a9e08)
	src/network/ssl/qsslkey_openssl.cpp
	src/plugins/platforms/android/androidjniinput.cpp
	src/plugins/platforms/xcb/qxcbconnection.cpp
	src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
	src/widgets/widgets/qmenu.cpp
	tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp

Change-Id: If7ab427804408877a93cbe02079fca58e568bfd3
2017-08-31 14:31:31 +02:00
Sérgio Martins
6522d4c487 Fix invalid placeholder name in tst_qsqlthread.cpp
Change-Id: I88c0c48888b86b58d85223ad1dc4cafdaea01d77
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2017-08-23 12:48:32 +00:00
Edward Welbourne
fbe84a1a19 Add a test that we can read SQL time-stamps
Based on a test-case from Israel Lins Albuquerque, that my planned
fixes to our parsing of ISODate date-times would break.

Change-Id: I5658df9c7daed59d43aa5574df25d4d9eac4677d
Reviewed-by: Israel Lins Albuquerque <israelins85@yahoo.com.br>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-08-04 11:19:39 +00:00
Oswald Buddenhagen
ee07b912a1 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	src/plugins/platforms/xcb/qxcbconnection.h
	src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
	src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
	src/plugins/styles/mac/qmacstyle_mac.mm
	src/widgets/widgets/qdockarealayout.cpp
	src/widgets/widgets/qmainwindow.cpp
	src/widgets/widgets/qmainwindowlayout.cpp
	src/widgets/widgets/qmainwindowlayout_p.h
	tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
	tests/auto/other/macnativeevents/BLACKLIST
	tests/auto/widgets/widgets/qmenu/BLACKLIST

Change-Id: Ic8e724b80a65e7b1af25511b0e674d209265e567
2017-08-02 22:52:32 +02:00
Joni Poikelin
0a5f71c606 Fix storing of QDateTime timespec for Sqlite
Commit 9e64fc9e1c caused a regression
which stored all QDateTime entries as if they were in localtime,
which causes them to be offset by the amount of local timezone
offset. This is fixed by adding "Z" if the time should be in UTC or
using "+/-hh:mm" if it should use fixed UTC offset or specific
timezone.

Task-number: QTBUG-57138
Change-Id: Ie60905dfb3a517db442b636ca41daf8348753d84
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2017-07-31 17:59:49 +00:00
Andy Shaw
0843c6ca7f QSqlField: Add a means to see what the tablename is for a given field
When you are using a query that pulls from a number of different tables
then it can be ambiguous as to which table a particular field belongs to.
So this will make it possible to determine the table that a given field
belongs to if it is set.

Task-number: QTBUG-7170
Change-Id: I49b7890c0523d81272a153df3860df800ff853d5
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-07-12 09:01:50 +00:00
Liang Qi
6a772fd201 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	.qmake.conf
	mkspecs/common/msvc-desktop.conf
	mkspecs/win32-g++/qmake.conf
	mkspecs/win32-icc/qmake.conf
	src/platformsupport/fontdatabases/mac/coretext.pri
	src/plugins/platforms/cocoa/qcocoawindow.h
	src/plugins/platforms/cocoa/qcocoawindow.mm

Change-Id: I74a6f7705c9547ed8bbac7260eb4645543e32655
2017-05-29 10:54:41 +02:00
Frederik Gladhorn
b8094e4b22 Stabilize tst_QSqlThread::readWriteThreading
According to the test metrics this test failed 10 times in the last two
days. Interestingly the log shows that usually 5.5 seconds would have
let it pass.

Change-Id: I38f21f35bd6624f1d3de1e1e811a4d107136a241
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
2017-05-18 21:18:02 +00:00
Jesus Fernandez
99d809bd75 Add move special member functions to QSqlError
Also mark as shared-come-qt6 and add member-swap.

[ChangeLog][QtSql][QSqlError] Added swap().

Coverity-Id: 168223
Change-Id: Iaad4dee383900b9d11856e860b0647780a81a505
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-04-28 12:50:34 +00:00
Andy Shaw
9292ea17a0 Use unique table name for the sqlite_enableRegexp test
This change amends 2a3297c726.

Task-number: QTBUG-59317
Change-Id: Ia08b83785f67105a1c7e71c1f4081f1bc755d756
Reviewed-by: Liang Qi <liang.qi@qt.io>
2017-03-27 09:07:02 +00:00
Liang Qi
ae2695535a Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	src/corelib/io/qfilesystemengine_win.cpp
	src/gui/text/qdistancefield.cpp
	src/plugins/platforms/xcb/qxcbconnection.h

Change-Id: I1be4a6f440ccb7599991159e3cb9de60990e4b1e
2017-03-20 09:00:44 +01:00
Marc Mutz
75f5e2bef2 Deprecate QString::null
It's a Qt 3 compatibility vehicle, and as such inherits the now-alien
property to distinguish empty and null strings. Particularly worrisome
is the following asymmetry:

   QString("") == QString::null          // false
   QString("") == QString(QString::null) // true

Instead of fixing this behavior, recognize that people might use it as
a weird way to call isNull(), albeit one that once was idiomatic, and
simply deprecate everything that deals with QString::null.

[ChangeLog][QtCore][QString] QString::null is now deprecated. When
used to construct a QString, use QString() instead. When used to
compare to a QString, replace with QString::isNull().

Change-Id: I9f7e84a92522c75666da15f49324c500ae93af42
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
2017-03-12 17:41:16 +00:00
Lorenz Haas
2a3297c726 REGEXP for SQLite
Since SQLite does not define a regexp function by default, provide a Qt
based implementation which can be enabled using QSQLITE_ENABLE_REGEXP as
an connect option. This way statements like

SELECT * FROM table WHERE col REGEXP '^[a-d]';

work out of the box.

[ChangeLog][QtSql] Add QSQLITE_ENABLE_REGEXP connect option for
QSQLiteDriver. If set a Qt based regexp() implementation is provided
allowing to use REGEXP in SQL statements.

Task-number: QTBUG-18084
Change-Id: I7f0e926fe4c5d6baea509f75497f46a61ca86679
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Sebastian Sauer <sebastian.sauer@kdab.com>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2017-02-22 21:14:23 +00:00
Friedemann Kleint
82a6f38873 tst_qsqlquery.cpp: Refactor runIntegralTypesMysqlTest()
Change 3370ab9119 introduced
warnings from MSVC:

tst_qsqlquery.cpp(4005): warning C4805: '==': unsafe mix of type 'const bool' and type 'int' in operation
tst_qsqlquery.cpp(4059): note: see reference to function template instantiation 'void runIntegralTypesMysqlTest<bool>(QSqlDatabase &,const QString &,const QString &,const bool,const T,const T)' being compiled
        with      [           T=bool       ]
tst_qsqlquery.cpp(4006): warning C4805: '==': unsafe mix of type 'const bool' and type 'int' in operation
tst_qsqlquery.cpp(4006): warning C4804: '/': unsafe use of type 'bool' in operation
tst_qsqlquery.cpp(4026): warning C4804: '+=': unsafe use of type 'bool' in operation

Extract an overload taking a QVector of values and use that for the
bool case instead of looping over min/max to generate a sequence of values
for bool.

Change-Id: I72583774e788b8df899f22ed1a64278217e664f6
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
2016-12-05 12:06:39 +00:00
Friedemann Kleint
8a2f544523 tst_qsql.cpp: Remove deprecated module include
Fix warning:
include/QtSql/qsql.h:4:4: warning: #warning Header <QtSql/qsql.h> is deprecated. Please include <QtSql/qtsqlglobal.h> instead. [-Wcpp]

Change-Id: I254c6ac9ddb0f49a7f4dc8b3de44fd1010f6243e
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2016-11-25 09:55:21 +00:00
Liang Qi
7555a92581 Merge remote-tracking branch 'origin/5.7' into 5.8
5971b88e is not needed in new configure.

This merge also reverts "fix QMAKE_DEFAULT_*DIRS resolution with
apple SDK", 2c9d15d7, because it breaks iOS build with new
configure system.

Conflicts:
	mkspecs/features/default_pre.prf
	mkspecs/features/mac/toolchain.prf
	mkspecs/features/toolchain.prf
	src/dbus/qdbusconnection.cpp
	src/plugins/sqldrivers/mysql/qsql_mysql.cpp
	src/sql/drivers/mysql/qsql_mysql.cpp
	src/widgets/widgets/qmenubar.cpp
	src/widgets/widgets/qmenubar_p.h
	tools/configure/configureapp.cpp
	tools/configure/environment.cpp
	tools/configure/environment.h

Change-Id: I995533dd334211ebd25912db05b639d6f908aaec
2016-09-21 11:57:52 +02:00