summaryrefslogtreecommitdiffstats
path: root/src/plugins/sqldrivers/mysql
Commit message (Collapse)AuthorAgeFilesLines
* SQL/MySQL: use categorized loggerChristian Ehrlicher2024-04-041-18/+27
| | | | | | | Use the categorized logger qt.sql.mysql Change-Id: I7e6529025dceb81c47571c65b7aea9bd274814e2 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* SQL/MySQL: pass UTC date/time stamps to the serverThiago Macieira2024-03-141-4/+25
| | | | | | | | | | | | | | | | | | | The MYSQL_TIME structure doesn't support per-datum timezone and in any case the server would not store it: the TIMESTAMP type is always stored in UTC. So instead let's configure the session time zone to UTC and use QDateTime to convert to/from it. Fixes https://bugs.kde.org/show_bug.cgi?id=483060 [ChangeLog][SQL][MySQL] Fixed a bug in passing QDateTime to be passed as local time to the server, regardless of the QDateTime's time zone setting. This would cause certain timestamps to be rejected by the server, such as a UTC time stamp whose time numerically matched the local timezone's spring forward gap in the transition into Daylight Savings Time. Change-Id: I6818d78a57394e37857bfffd17bbce4ae43e823c Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* SQL/MySQL: merge toMySqlDate (which returned MYSQL_TIME) into exec()Thiago Macieira2024-03-141-33/+25
| | | | | | | | | | | | It was the only place that called it. Makes the code slightly uglier, but removes a function that returned a raw pointer. More importantly, it gets the actual type from QVariant, without relying on it internally converting from QDateTime to QDate and QTime, or failing to do so in some cases. This is going to be needed for the next commit. Pick-to: 6.5 6.6 6.7 Change-Id: I6818d78a57394e37857bfffd17bbcd3f5057eadc Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* SQL/QSqlField: deprecate internal functions setSqlType()/typeID()Christian Ehrlicher2024-03-101-1/+0
| | | | | | | | | These functions set/get the db-specific internal sql type but it's not used in any of the sql plugins since ages. Any external plugin using this for some reason must be ported away until Qt7. Change-Id: Ifb33e9d3be0b80fb4d0979d31436e89ea6a8208b Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* SQL/MySQL: retrieve default column value for QSqlDatabase::record()Christian Ehrlicher2024-03-101-1/+28
| | | | | | | | | | Retrieve the default value (if set) of a column during QSqlDatabase::record() but not for QSqlQuery::record() as it's done for the other drivers which support retrieving the default column value. Fixes: QTBUG-122723 Change-Id: I92e052bfa6d88e019c0151fbcbc1483a65770c55 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* SQL/MySQL: Fix compilation with MySQL 8.3Christian Ehrlicher2024-01-221-17/+11
| | | | | | | | | | | | | | | | With MySQL 8.3 mysql_fetch_field() was removed which was used in QMYSQLDriver::record(). There is no real replacement function so we use 'SELECT * from table LIMIT 0' to retrieve the schema information. Additionally mysql_stmt_bind_param() was deprecated and needs to be replaced by mysql_stmt_bind_named_param(). [ChangeLog][SQL][MySQL] Fixed compilation with MySQL 8.3. Pick-to: 6.7 6.6 6.5 6.2 5.15 Fixes: QTBUG-121183 Change-Id: I149836bd5674d0784255baf416d437c424992f20 Reviewed-by: silverqx <silver.zachara@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* SQL: use QT_NO_CONTEXTLESS_CONNECT for sql pluginsChristian Ehrlicher2023-07-191-0/+1
| | | | | | | | | Use QT_NO_CONTEXTLESS_CONNECT to disable 3-arg connects which are considered dangerous. Change-Id: I0ac711491de60e0eeaca9edb60715eafe9da841a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* SQL/MySQL: properly initialize variableChristian Ehrlicher2023-04-111-3/+3
| | | | | | | | | | Properly initialize outBinds - even it should be initialized by mysql/mariadb client lib we should correctly initialize it with 0 to avoid valgrind warnings about accessing uninitialized data. Pick-to: 6.5 6.2 5.15 Change-Id: I85b99a7e639dad9f8d24f554cd96c5997a5838ae Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL/MySQL: add option MYSQL_OPT_TLS_VERSION & MYSQL_OPT_SSL_MODEChristian Ehrlicher2023-04-061-0/+27
| | | | | | | | | | | | | | Add the two options MYSQL_OPT_TLS_VERSION and MYSQL_OPT_SSL_MODE to properly support encrypted connections to MySQL 8.0 servers. MYSQL_OPT_SSL_MODE will not work when compiled against the MariaDB C-Connector since it's not supported by the MariaDB client. [ChangeLog][QtSql][MySQL] Added the two new connect options MYSQL_OPT_TLS_VERSION and MYSQL_OPT_SSL_MODE. Fixes: QTBUG-84797 Change-Id: Iec7d682fc00072ce5b2a824c4ea00fca4575a93e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL/MySQL: Add support for Bit-Value Type - BITChristian Ehrlicher2023-03-121-2/+28
| | | | | | | | | | | | 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>
* SQL/MySQL: fix QSqlDatabase::tables() with MySQL 8.0.xChristian Ehrlicher2023-03-121-2/+5
| | | | | | | | | | | | The (undocumented) struct MYSQL returned by mysql_real_connect() no longer stores the db name in MYSQL.db but something else. This leads to a wrong select statement within QMYSQLDriver::tables(). Therefore store the current database name in QMYSQLDriverPrivate to be able to use it in tables() later on. Pick-to: 6.5 6.2 5.15 Change-Id: I27d3345dd44a0d8642ca120cddc5c151b8bed85d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* ODBC/MySQL: fix compilation with MySQL < 5.7.9Christian Ehrlicher2023-02-121-0/+5
| | | | | | | | | | | MYSQL_TYPE_JSON was introduced in MySQL 5.7.9 but our documentation states that we still support 5.6 so we have to define this value by ourself for the older versions. Pick-to: 5.15 6.2 6.4 6.5 Fixes: QTBUG-109832 Change-Id: I935edb14495d162ed58109610946b2805d37bbc4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* SQL/MySQL: add options to explicitly specify the protocol typeChristian Ehrlicher2023-02-121-0/+20
| | | | | | | | | | | | [ChangeLog][QtSql] Added the ability to specify the MySQL/MariaDB connection type using the "MYSQL_OPT_PROTOCOL" connection string option. In case the connection type is "MEMORY" for shared memory, applications can specify the shared memory segment name using the "MYSQL_SHARED_MEMORY_BASE_NAME" option. Fixes: QTBUG-2551 Change-Id: I91e0981994c045fb74478d0e765e2ec24eefeece Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* src: Remove remains of qmake conversion from CMakeLists.txt filesFriedemann Kleint2023-02-101-5/+0
| | | | | | Pick-to: 6.5 Change-Id: Id644d322a602038403bb7f46c532744575fbf6d3 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* SQL/MySQL: Fix retrieving a datetime for libmysql >= 8.0.27Christian Ehrlicher2023-02-101-9/+19
| | | | | | | | | | | | | | Somewhere between libmysql 8.0.18 and 8.0.27, the MYSQL_TIME structure gained an additional member which increased the struct size by 4 bytes. This makes an internal check for the correct size of the structi go fail. Since it can now happen that the plugin is linked against a new libmysql and used with an old and the other way round, duplicate the old MYSQL_TIME struct to use this in our code Pick-to: 6.4 6.5 Fixes: QTBUG-110967 Change-Id: I5bc631179a0a1be47a5966954e757f27a72f1592 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* SQL/MySQL: add connect option MYSQL_OPT_LOCAL_INFILEChristian Ehrlicher2022-12-081-0/+1
| | | | | | | | | Add the connect option MYSQL_OPT_LOCAL_INFILE to be able to specify the client-side LOCAL capability for LOAD DATA operations Fixes: QTBUG-104916 Change-Id: I9914250059e7dc1a705941d3b409fa624e105ecd Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* SQL/MySQL: don't use deprecated defines, cleanupChristian Ehrlicher2022-12-081-31/+31
| | | | | | | | | Replace plain int with enum 'enum_field_types' and don't use deprecated MySQL type names. Pick-to: 6.4 Change-Id: I8a629ac1b4ad7d6d78604ff641b5b35397cd769c Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* SQL/MySQL: fix handling of json columnChristian Ehrlicher2022-12-051-1/+3
| | | | | | | | | | | 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>
* SQL/MySQL: rework driver option parsingChristian Ehrlicher2022-10-221-74/+83
| | | | | | | | | | Rework the parsing of client option to make it easier to add new options. Add the two options MYSQL_OPT_SSL_CRL and MYSQL_OPT_SSL_CRLPATH and deprecate the SSL_foo options without the MYSQL_OPT_ prefix. Change-Id: Ibaf5f553d77d9c102ca2bfef2fe68be0572f594b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL/MySQL: misc cleanupChristian Ehrlicher2022-10-211-32/+23
| | | | | | | Cleanup the code a little bit and use qsizetype on some obvious places. Change-Id: Ib9e5ec79a39c45c9fab7e21dbda70ed728025191 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Port from container.count()/length() to size()Marc Mutz2022-10-041-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is semantic patch using ClangTidyTransformator: auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o) makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'. <classes> are: // sequential: "QByteArray", "QList", "QQueue", "QStack", "QString", "QVarLengthArray", "QVector", // associative: "QHash", "QMultiHash", "QMap", "QMultiMap", "QSet", // Qt has no QMultiSet Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-08-231-1/+1
| | | | | | | Task-number: QTBUG-105718 Change-Id: I5d3ef70a31235868b9be6cb479b7621bf2a8ba39 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Add license headers to cmake filesLucie Gérard2022-08-031-0/+3
| | | | | | | | | | | | 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>
* MySQL plugin: fix escaping a QByteArrayChristian Ehrlicher2022-07-251-1/+1
| | | | | | | | | | | 1df974590f19dec7b632d000ab9408a4de6f117a introduced a regression which kills the escaping of a QByteArray because QString::fromUtf8() gets a wrong length from a QVarLengthArray. Pick-to: 6.4 Fixes: QTBUG-105078 Change-Id: Ic2f76c82c246e1e9eaf1d3f907d11fc345b5655e Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
* Fix typos in docs and commentsKai Köhne2022-06-151-1/+1
| | | | | | | | | Found by codespell Pick-to: 6.4 Change-Id: Ie3e301a23830c773a2e9aff487c702a223d246eb Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-163-114/+6
| | | | | | | | | | | | | 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>
* Revert "MySQL: pedantism: create and destroy the MYSQL_TIME type"Thiago Macieira2022-05-121-7/+3
| | | | | | | | | | This reverts commit 6feb28918924d80c94b6f435bc3bc981855d59d6. It causes a crash when field.myField is null. Fixes: QTBUG-102489 Pick-to: 6.3 Change-Id: I7e305799c8594ebab255fffd16ee1a41cac8d387 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* QMYSQLDriverPlugin: includemocsMarc Mutz2022-04-281-0/+2
| | | | | | | | | | | Including moc files directly into their classes' TU tends to improve codegen and enables extended compiler warnings, e.g. about unused private functions or fields. Pick-to: 6.3 6.2 5.15 Task-number: QTBUG-102886 Change-Id: Idf1a38d8a293e3cbf74443f00d2a9765eb68a9c0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Sql: replace remaining uses of QLatin1String with QLatin1StringViewSona Kurazyan2022-04-191-2/+2
| | | | | | Task-number: QTBUG-98434 Change-Id: Ia621f9d937649dda41a7b0d13a61e6f1397f6dde Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Sql: use _L1 for for creating Latin-1 string literalsSona Kurazyan2022-04-192-29/+32
| | | | | | Task-number: QTBUG-98434 Change-Id: Ie12ca82fd912617eabe4f602c08914f12878cb32 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Sql: stop using QLatin1Char constructor for creating char literalsSona Kurazyan2022-04-191-14/+13
| | | | | | | | | | | Required for porting away from QLatin1Char/QLatin1String in scope of QTBUG-98434. As a drive-by, fix qsizetype -> int narrowing conversion warnings for the touched lines. Change-Id: I03477e645a94948cac3e3e2abca52aa4e3e2efff Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Sql: Do not depend on transitive includesFabian Kosmale2022-03-171-0/+1
| | | | | Change-Id: I9407c34c9fb6add655649dd7058bce7a25be5f5d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Adapt SQL drivers to Qt 6 change of QVariant::isNullVolker Hilsheimer2022-01-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | In Qt 5, QVariant::isNull returned true if either the variant didn't contain a value, or if the value was of a nullable type where the type's isNull member function returned true. In Qt 6, QVariant::isNull only returns true for variants that don't contain a value; if the value contained is e.g. a null-QString or QDateTime, then QVariant::isNull returns false. This change requires a follow up in the SQL drivers, which must still treat null-values the same as null-variants, lest they write data into the data base. Add a static helper to QSqlResultPrivate that implements isNull-checking of variants that contain a nullable type relevant for Sql, and add a test case to the QSqlQuery test that exercises that code. Pick-to: 6.2 6.3 Fixes: QTBUG-99408 Fixes: QTBUG-98471 Change-Id: I08b74a33aa3235c37d974f182da1f2bdcfd8217e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* MySQL: only set the charset if the connection has succeededThiago Macieira2021-10-191-13/+14
| | | | | | | | | | No point otherwise. But do it before trying to select the database, in case the database name has non-US-ASCII characters. Task-number: QTBUG-97054 Pick-to: 6.2 6.2.1 Change-Id: Iea05060bc2c046928536fffd16adf036367b07bb Reviewed-by: Liang Qi <liang.qi@qt.io>
* MySQL: fix the check for the return value of mysql_set_character_set()Thiago Macieira2021-10-191-2/+2
| | | | | | | | | It returns zero on success and non-zero on failure. Fixes: QTBUG-97054 Pick-to: 6.2 6.2.1 Change-Id: Iea05060bc2c046928536fffd16adf0177aadb082 Reviewed-by: Liang Qi <liang.qi@qt.io>
* MySQL: pedantism: create and destroy the MYSQL_TIME typeThiago Macieira2021-08-181-3/+7
| | | | | | | | This is a no-op. But take the opportunity to make a drive-by update on the loop, which improves it. Change-Id: I4a40ccbd3321467a8429fffd169b08590d28c928 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* MySQL: implement binding output (SELECT) results to MYSQL_TIMEThiago Macieira2021-08-181-0/+23
| | | | | | | We already do it for inputs but weren't doing it for outputs. Change-Id: I4a40ccbd3321467a8429fffd169afeb5730ad75e Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* MySQL: don't allocate 1-byte buffers for BLOBsThiago Macieira2021-08-171-1/+1
| | | | | | | | | We set the buffer length to 0 for blobs, as we need to do it for each row, in bindBlobs() (apparently a workaround for MySQL 4.1.8 API). That function was deleting the buffer and reallocating. Change-Id: I4a40ccbd3321467a8429fffd169b06422612ca13 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* MySQL: treat the MYSQL_FIELD as read-onlyThiago Macieira2021-08-171-14/+13
| | | | | | | | | | | | | | | | | | The MariaDB-connector-c version 3.2 and MariaDB server version 10.6 cooperate to avoid re-transferring the query metadata, so the fact that we were modifying it was causing it to improperly decode the DATETIME data types into string, as we had asked. We ended up with a 7-byte string that was actually the date binary-encoded. References: - https://jira.mariadb.org/browse/MDEV-26271 - https://github.com/MythTV/mythtv/issues/373 - https://bugs.kde.org/show_bug.cgi?id=440296 Pick-to: 5.12 5.15 6.2 Fixes: QTBUG-95639 Change-Id: I4a40ccbd3321467a8429fffd169afdbb26cf29f6 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* MySQL: remove left-over charset-setting codeThiago Macieira2021-08-171-7/+0
| | | | | | | | Complements commit 472520afb9081856a2556c7df221c084a42a2d42. We were doing it twice. Change-Id: I4a40ccbd3321467a8429fffd169b05fa5e22f204 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* MySQL: properly fix setting the character setThiago Macieira2021-08-101-3/+31
| | | | | | | | | | | | | | | Commit e4bd73dc54542fe16121825c2a369b7f863e0de8 moved the mysql_set_character_set() call above the mysql_real_connect() but that doesn't actually work, as there's no connection to send the "SET NAMES" statement on. So do it in two steps: first, by setting the charset in the MYSQL structure, then by asking the server to match. Pick-to: 6.2 Task-number: QTBUG-55444 Change-Id: I4a40ccbd3321467a8429fffd1699bd829f342124 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* MySQL: don't format QDateTime with timezonesThiago Macieira2021-08-101-0/+14
| | | | | | | | | | | | | | | | | | | | | Neither MySQL nor MariaDB like it. According to the documentation[1], MySQL now accepts timezones using the [+-]HH:MM format (and -00:00 is rejected). MariaDB does not accept timezones at all[2]. This has apparently been broken since Qt 5.0 (the "Z" suffix was introduced in commit 2528f4ffe53dfbd640249f63497522929264f3d7), but this issue was never noticed because the of prepared queries: when they're in use, we transfer the time using a MYSQL_TIME structure, which does not support timezone offsets either. We've only noticed this issue when the code to determine if the MySQL client library supported prepared statements broke. [1] https://dev.mysql.com/doc/refman/8.0/en/date-and-time-literals.html [2] https://mariadb.com/kb/en/date-and-time-literals/ Task-number: QTBUG-95071 Change-Id: I4a40ccbd3321467a8429fffd1699cc4c050ae746 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* MySQL: remove the version number checks in favor of actual functionalityThiago Macieira2021-08-101-2/+15
| | | | | | | | | | | | | | | | | | | | | MariaDB library version 3.2 no longer returns the server version in the 10.x range but the library version itself, which is lower than 4.x. That meant we concluded the server did not support prepared statements. And because of the lack of prepared statements, all QDateTime conversions failed, because of the timezone. I don't know if this was intended or what, but it's a side issue. [ChangeLog][QtSql][MySQL] Fixed the detection of whether the client and server support prepared statements. This was caused by the mariadb connector library reporting its own version numbers (starting in version 3.2) instead of the server version. Fixes: QTBUG-95071 Pick-to: 5.15 6.2 Change-Id: I4a40ccbd3321467a8429fffd1699bc089ba706e6 Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Fabian Vogt <fabian@ritter-vogt.de>
* CMake: Rename qt6_add_plugin TYPE option to PLUGIN_TYPEAlexandru Croitor2021-08-061-1/+1
| | | | | | | | | | | | | The intention is to remove TYPE as a keyword completely before 6.2.0 release, but in case if that's not possible due to the large amount of repositories and examples, just print a deprecation warning for now and handle both TYPE and PLUGIN_TYPE. Task-number: QTBUG-95170 Pick-to: 6.2 Change-Id: If0c18345483b9254b0fc21120229fcc2a2fbfbf5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Port some fallthrough comments to Q_FALLTHROUGHGiuseppe D'Angelo2021-06-131-1/+1
| | | | | Change-Id: I70dd492d5c8d198589bfd642db63182cf17b133f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* CMake: Fix building multi-arch universal macOS QtAlexandru Croitor2021-04-011-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use the same approach we use for iOS, which is to set multiple CMAKE_OSX_ARCHITECTURES values and let the clang front end deal with lipo-ing the final libraries. For now, Qt can be configured to build universal macOS libraries by passing 2 architectures to CMake, either via: -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" or -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" Currently we recommend specifying the intel x86_64 arch as the first one, to get an intel slice configuration that is comparable to a non-universal intel build. Specifying the arm64 slice first could pessimize optimizations and reduce the feature set for the intel slice due to the limitation that we run configure tests only once. The first specified architecture is the one used to do all the configure tests. It 'mostly' defines the common feature set of both architecture slices, with the excepion of some special handling for sse2 and neon instructions. In the future we might want to run at least the Qt architecture config test for all specified architectures, so that we can extract all the supported sub-arches and instruction sets in a reliable way. For now, we use the same sse2 hack as for iOS simulator_and_device builds, otherwise QtGui fails to link due to missing qt_memfill32_sse2 and other symbols. The hack is somewhat augmented to ensure that reconfiguration still succeeds (same issue happened with iOS). Previously the sse2 feature condition was broken due to force setting the feature to be ON. Now the condition also checks for a special QT_FORCE_FEATURE_sse2 variable which we set internally. Note that we shouldn't build for arm64e, because the binaries get killed when running on AS with the following message: kernel: exec_mach_imgact: not running binary built against preview arm64e ABI. Aslo, by default, we disable the arm64 slice for qt sql plugins, mostly because the CI provisioned sql libraries that we depend on only contain x86_64 slices, and trying to build the sql plugins for both slices will fail with linker errors. This behavior can be disabled for all targets marked by qt_internal_force_macos_intel_arch, by setting the QT_FORCE_MACOS_ALL_ARCHES CMake option to ON. To disble it per-target one can set QT_FORCE_MACOS_ALL_ARCHES_${target} to ON. Task-number: QTBUG-85447 Change-Id: Iccb5dfcc1a21a8a8292bd3817df0ea46c3445f75 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QSql/MariaDB/MySQL: use utf-8 as encoding for username and passwordChristian Ehrlicher2021-03-191-29/+20
| | | | | | | | | | | | | The mariadb driver sets the encoding for the connection to utf-8 but only after the username and password was already set. Therefore non-ascii characters were not correctly encoded when the local character set was not the default one from the database. Move mysql_set_character_set() above the username/password setting and encode all as utf-8 instead local8Bit. Fixes: QTBUG-55444 Change-Id: Iff7ee24159d54b578cd854e620aa814d72da3801 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* QSql/MariaDB/MySQL: misc cleanupChristian Ehrlicher2021-03-081-24/+16
| | | | | | | | | | Cleanup the mariadb driver a little bit: - use nullptr instead NULL - use unsigned long instead int for blob handling now that QByteArray can handle more than 2^31 bytes Change-Id: I79639a42a739aabdf776cc688cb5d664248aa610 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* cmake: Don't give plugins PUBLIC usage requirementsCraig Scott2021-02-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | The pro2cmake.py conversion script faithfully reproduced the .pro files for the plugins, which specified the libraries as public. But in CMake, the implications of this are that public usage requirements should then be propagated to consumers. We don't expect any consumers, since a plugin is created as a MODULE library in CMake, so for Windows we don't even have an import library to link with. The only exception to this is for static builds where plugins are created as STATIC libraries instead, but only in certain controlled situations do we then link to plugins. Even then, usage requirements are not expected to propagate to the consumers, so these relationships should always be specified as private. This change warns on any PUBLIC usage requirements specified for a plugin. This check is disabled by default to avoid spamming CI builds for repos that haven't been fixed yet. The check can be enabled by a CMake cache option, which is intended for developers to use locally when fixing this issue in other repos (all plugins in qtbase should not trigger this warning as a result of changes in this commit). Task-number: QTBUG-90819 Pick-to: 6.1 Change-Id: I09f2c8da77db1193ad3370f85d367dfc6ab7b9a6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Remove the qmake project filesJoerg Bornemann2021-01-071-11/+0
| | | | | | | | | | | | | | | | Remove the qmake project files for most of Qt. Leave the qmake project files for examples, because we still test those in the CI to ensure qmake does not regress. Also leave the qmake project files for utils and other minor parts that lack CMake project files. Task-number: QTBUG-88742 Change-Id: I6cdf059e6204816f617f9624f3ea9822703f73cc Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Koehne <kai.koehne@qt.io>