SQL/MySQL: adjust check for MariaDB client library
The correct define to check for MariaDB C Connector is MARIADB_PACKAGE_VERSION_ID, not MARIADB_BASE_VERSION (which is a string describing the server version the c connector relates to). Pick-to: 6.9 6.8 Task-number: QTBUG-136550 Change-Id: I844900d9b6622fd3a72db63298e5c34de8a2f3dc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
fd09d6f5d5
commit
dbbe65fb26
@ -1094,14 +1094,14 @@ static void qLibraryInit()
|
||||
}
|
||||
#endif // Q_NO_MYSQL_EMBEDDED
|
||||
|
||||
#if defined(MARIADB_BASE_VERSION) || defined(MARIADB_VERSION_ID)
|
||||
#if defined(MARIADB_PACKAGE_VERSION_ID)
|
||||
qAddPostRoutine([]() { mysql_server_end(); });
|
||||
#endif
|
||||
}
|
||||
|
||||
static void qLibraryEnd()
|
||||
{
|
||||
#if !defined(MARIADB_BASE_VERSION) && !defined(MARIADB_VERSION_ID)
|
||||
#if !defined(MARIADB_PACKAGE_VERSION_ID)
|
||||
# if !defined(Q_NO_MYSQL_EMBEDDED)
|
||||
mysql_library_end();
|
||||
# endif
|
||||
@ -1360,7 +1360,7 @@ bool QMYSQLDriver::open(const QString &db,
|
||||
|
||||
// try utf8 with non BMP first, utf8 (BMP only) if that fails
|
||||
static const char wanted_charsets[][8] = { "utf8mb4", "utf8" };
|
||||
#ifdef MARIADB_VERSION_ID
|
||||
#if defined(MARIADB_PACKAGE_VERSION_ID)
|
||||
MARIADB_CHARSET_INFO *cs = nullptr;
|
||||
for (const char *p : wanted_charsets) {
|
||||
cs = mariadb_get_charset_by_name(p);
|
||||
@ -1512,7 +1512,7 @@ QSqlRecord QMYSQLDriver::record(const QString &tablename) const
|
||||
+ d->dbName + "' AND table_name = '%1'"_L1;
|
||||
const auto baTableName = tablename.toUtf8();
|
||||
QVarLengthArray<char> tableNameQuoted(baTableName.size() * 2 + 1);
|
||||
#if defined(MARIADB_VERSION_ID)
|
||||
#if defined(MARIADB_PACKAGE_VERSION_ID)
|
||||
const auto len = mysql_real_escape_string(d->mysql, tableNameQuoted.data(),
|
||||
baTableName.data(), baTableName.size());
|
||||
#else
|
||||
|
Loading…
x
Reference in New Issue
Block a user