Sync the IBASE driver behavior for primaryIndex() and record() with the
rest by assuming that the given table name has the correct casing.
Change the tests for these two function to pass an unescaped table name.
Change-Id: I6d96359f97e1acc6970b9a22fdf0e968a616b7bc
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
[ChangeLog][SQL][SqlQuery] Added two new functions
boundValueName()/boundValueNames() to return the names of the bound
values.
Fixes: QTBUG-97847
Change-Id: I8df5f15e8df13141a34d38b0a2e13b37f4e7829c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The alias created by QSqlRelationTableModel to avoid duplicated field
names was not escaped which lead to an inconsistency in the returned
alias name from the database (e.g. postgres lowers all unescaped column
names).
Also adjust the test for QSqlRelationTableModel to use escaped table
names for it's tests and fix it for QIBASE.
Change-Id: I01426320c0c1a70cb9bf8e6dfa2f8b07dbb1c06b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Add a testcase for toSQLTCHAR() to make sure to pass the correct number
of encoded characters to the odbc functions.
Pick-to: 6.5
Task-number: QTBUG-112375
Change-Id: Ib67fab678fc3d0b098aedfc6fa9ec2139f2e75c7
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
A QSqlError is not equal when the native error code differs. The
database and driver text should not be considered during the
comparison because they might differ due to e.g. different locales.
[ChangeLog][QtSql][QSqlError] The comparison operators have been fixed to
take both error type and error code into account.
Change-Id: Ie7511f183f88dd454eb165c6ff237e51b79d1c08
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Add the move ctor and move operator for QSqlIndex, also add an explicit
testcase for QSqlIndex
Task-number: QTBUG-109938
Change-Id: I46cc6a24c2e7d5b23d2ac3427cafd01b9ba257ed
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Add support for time zones in the IBASE driver, which was introduced in
firebird 4.x. TIMESTAMP WITH TIME ZONE data type is supported in order
to store and retrieve a QDateTime with the time zone.
Task-number: QTBUG-111879
Change-Id: I631b4262d17796a17630379b7d659f88244a23ad
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Cleanup tst_databases.h: fix identation, replace qGetHostName() with
QSysInfo::machineHostName(), use QSqlTableModel::EditStrategy instead
int for submitpolicy data to avoid casts.
Change-Id: I4917ca23c4b39ab15bc0e006e6111baefb82d278
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Fix some tests so they will correctly work with Interbase (Firebird 3.x)
Change-Id: Ib3c8ceaf31fa01af3a00a9772350b49cee8b2342
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
A table name or identifier must not be longer than 30 (< Oracle 12.2) or
128 bytes (sadly not characters).
Change-Id: I49192afaf908e12f5cfd20c754640b6117b03a71
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Add support for MYSQL_TYPE_BIT. Since the bitfield can be max 64bits,
store it in a uint64_t. Writing such a value as MYSQL_TYPE_LONGLONG
works as expected but receiving it needs a special handling.
[ChangeLog][SQL][MySQL] Added handling for Bit-Value Type - BIT.
Fixes: QTBUG-21326
Change-Id: Id20e3316caf6703b3bec8a828144494a20693fd8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Add a helper class which makes sure that the used table does not exist
before usage (e.g. due to leftovers from previous tests) and is properly
cleaned up on exit. This also allows to remove all usages of
safeDropTable().
Change-Id: Iefeffbd10e2f2f67985183ea822d7b6dd2b80be7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
And fix coding style a little bit around the change.
Change-Id: Idfc232a751ccc08d0680351d48d4a68f09f18c1f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The note that QSqlDatabase::exec() is deprecated was added more than 12
years ago so it's time to also mark the function as such.
Change-Id: Ic5e7c31b3ff5b21e16e2640548cba1a4baaeeb1c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
remove toHex() as it's not used at all and qTableName() with two params.
Also remove some SQLite 2 specific stuff
Change-Id: If285febdfbee5833f7174d70f386bd54674bd539
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Make sure to properly close the cloned database connections and allow
one test for sqlite
Change-Id: Ia4eb4a684a3c432844e4b2a77bff69655b53f9b2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
They were leftovers from QTDS driver removed with Qt6
Change-Id: I34863912bd41e0b4ca54bf443001f1cb3f20511a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The QtSql for Mimer SQL sqldriver makes it possible to work with the
Mimer SQL database on different plattforms. There are drivers for
several other databases in QtSql and a driver for Mimer SQL will
benefit many users.
To build the Mimer SQL driver, download Mimer SQL from
https://developer.mimer.com
[ChangeLog][QtSql]
Added a QtSql plugin to work with the Mimer SQL database
Fixes: QTBUG-111219
Change-Id: Id6ba5de4de01189d0516ffbfa89efcb0d013115f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The 'WITH OIDS' was deprecated some time ago and removed with
PostgreSQL 12 so we have to adjust our test table creations. Don't know
why it was used in the first place at all.
Pick-to: 6.2 6.4 6.5
Change-Id: I6e18ac01e64368b1dd64e02bcb75fa70e05467a3
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Also replace the C array with a std::array and (some) indexed loops
with ranged-for loops. Most loops need the index in one way of
another, so can't easily be converted to ranged.
Pick-to: 6.5 6.4 6.2
Change-Id: I7fa05f22de9df6c68ec5797c9583476a3881532c
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
testWhiteSpaceNames() returns true for all current database drivers so
it's useless and can be removed. safeDropView() and getPSQLVersion()
is not called anywhere, getMySqlVersion() is only used for a check for a
MySql version we no longer support.
Change-Id: I8d02f17f475821e81d309ee96897e772cdfb895d
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
In the process actually handle all time-spec cases in various places
that only handled UTC or LocalTime, or at least note that they don't
where that's not practical. Also tidy up header ordering and ensure
QDateTime's header is included wherever it's used, while adding the
include for QTimeZone where needed.
Task-number: QTBUG-108199
Change-Id: Ic1a5cdf0aaf737bf1396aa8ac58ce2004cef7e19
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Add handling for MYSQL_TYPE_JSON by treating it the same as
MYSQL_TYPE_BLOB (which is used by current MariaDB Server for a json
column)
Pick-to: 5.15 6.2 6.4
Fixes: QTBUG-101680
Change-Id: I4d4b0cdad73cd12e0db4df4021fddbd6a649c8ed
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to
handle typedefs and accesses through pointers, too:
const std::string o = "object";
auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); };
auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) {
auto exprOfDeclaredType = [&](auto decl) {
return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o);
};
return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))));
};
auto renameMethod = [&] (ArrayRef<StringRef> classes,
StringRef from, StringRef to) {
return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)),
callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))),
changeTo(cat(access(o, cat(to)), "()")),
cat("use '", to, "' instead of '", from, "'"));
};
renameMethod(<classes>, "count", "size");
renameMethod(<classes>, "length", "size");
except that the on() matcher has been replaced by one that doesn't
ignoreParens().
a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'.
Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache,
to avoid porting calls that explicitly test count().
Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
MySQL has a different default setting for case sensitive table names on
linux and windows which makes the test fail on linux but work on
windows when using the database with the default settings. Read out the
respecitive setting so the test will pass every time.
Change-Id: I8651858d47652022ddc4b6386a6153cf70c6fed6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
It makes it impossible to rerun it, bad for both CI and local test runs.
As a drive-by name the database file sqlite.db instead of foo.db
Pick-to: 6.2 6.4
Fixes: QTBUG-100245
Change-Id: I2e4ee01189ccbad2a6add5db7771d35fd7248da8
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Fix two tests which got broken due to the latest changes without
notifying because those tests are not run automatically.
Change-Id: Ibe9d9601f0a2ad4ce8f06ca21e7503e77fa55781
Reviewed-by: Fredrik Ålund <fredrik.alund@mimer.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.
Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace, with manual
unstaging of the actual definition and documentation in dist/,
src/corelib/doc/ and src/corelib/global/.
Task-number: QTBUG-99313
Change-Id: I4c7114444a325ad4e62d0fcbfd347d2bbfb21541
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
CMakeLists.txt and .cmake files of significant size
(more than 2 lines according to our check in tst_license.pl)
now have the copyright and license header.
Existing copyright statements remain intact
Task-number: QTBUG-88621
Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.
Task-number: QTBUG-67283
Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
And remove their uses.
[ChangeLog][QtCore][Deprecation Notice] Deprecated QString::count()
and QByteArray::count() that take no parameters, to avoid confusion
with the algorithm overloads of the same name. They can be replaced
by size() or length() methods.
Change-Id: I6541e3235ab58cf750d89568d66d3b1d9bbd4a04
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
More mindless coding-style conformance. Includes moving & or * to
after the space, not before, in declarations; and spaces after commas.
Change-Id: I221fef1e4de69d6c55d33dfc533aa74e2fd72df0
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
With one exception: in a macro-definition with a backslash-newline
immediately following the open-parenthesis.
Change-Id: I0fc8d7492676402636785d571e4667881334af6a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Simply if (!condition) QSKIP(...) instead of having a long block
depend on the condition with the QSKIP() in its else block (which
should have had braces, as it was).
While dedenting the code block, tidied up spacing: only include blank
lines where they break up the code into blocks that go together, don't
leave spaces just inside parentheses.
Change-Id: I0196150088be88a7c6073b997a315b8f14d5f392
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Use QVERIFY() rather than comparison to true; QVERIFY() the negation
rather comparing to false; prefer QCOMPARE() otherwise for
comparisons, except for a few special cases involving very long
strings. Fix up the phrasing of a few QSKIP()s in the process.
Also, QCOMPARE() can handle an enum as expected value without
int-casting.
Change-Id: I9a1b82e5f4e10df6427bcc184b7757737df7db4f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
In some cases by adjusting where the splits happen within concatenated
strings.
Change-Id: I4cffc41cda4582654151ba45d1478285caee7c81
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Prefer pre-decrement over post-decrement, turn a while into a for,
Don't put a while's body on the same line.
Change-Id: I5653a9bcec7901d205a91927c4b08e3dc13e0ca6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reflowed some over-long ones, fixed some typos, capitalise starts of
sentences (and end them with suitable punctuation). Removed one as
redundant, made another pair redundant by changing the code (use an
overt NaN instead of commenting that it's happening). Prefer C++-style
when single-line. Don't pretend to be QDoc comments, or have other
eccentricities about start-markers.
Change-Id: I5a30e1b22a08866124f09060bb35f5bd27cd443b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Much of the test code simply had a blank line after each check. Keep
the ones that separate groups of related statements, but remove the
ones that separated members of such groups. In some cases swap a blank
line and a code line to put the code with things it relates to.
Change-Id: Ie33863080d407898b2b2f044599398980ab9793d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Split some long declarations of two variables in one line into two
separate declarations. Made more things const, made some consts
constexpr. Skip a variable entirely when it's only used once (and not
giving us some other benefit). Moved some declarations closer to their
variables' first uses.
Replace some Capitalised variable names with lower-case ones.
Change-Id: I3b8dac46530ba1c2e6100cb007b5487253304526
Reviewed-by: Marc Mutz <marc.mutz@qt.io>