SQL/ODBC: don't escape a driver string

We must not try to escape a driver string, the user has to make sure
that everything is correctly escaped when passing a complete driver
string. This fixes a regression from QTBUG-122642.

Fixes: QTBUG-123444
Change-Id: I43316c7a09060f5c8117fdc3c464d239e37d9cdf
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
(cherry picked from commit 9873f4b283dcabefc20b1720bef1958c2b1ccc02)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Christian Ehrlicher 2024-04-01 19:06:34 +02:00 committed by Qt Cherry-pick Bot
parent 81581819c7
commit 8f25cdc94e
2 changed files with 8 additions and 3 deletions

View File

@ -1968,7 +1968,7 @@ bool QODBCDriver::open(const QString & db,
connQStr = "FILEDSN="_L1 + ensureEscaped(db);
else if (db.contains("DRIVER="_L1, Qt::CaseInsensitive)
|| db.contains("SERVER="_L1, Qt::CaseInsensitive))
connQStr = ensureEscaped(db);
connQStr = db;
else
connQStr = "DSN="_L1 + ensureEscaped(db);

View File

@ -404,15 +404,20 @@
of the ODBC driver. ODBC support can be used as a fallback for compliant
databases if no native driver is available.
On Windows, an ODBC driver manager should be installed by default.
On Windows, an ODBC driver manager is installed by default.
For Unix systems, there are some implementations which must be
installed first. Note that every end user of your application is
required to have an ODBC driver manager installed, otherwise the
QODBC plugin will not work.
When connecting to an ODBC datasource, you should pass the name
of the ODBC datasource to the QSqlDatabase::setDatabaseName()
of the ODBC datasource (DSN) to the QSqlDatabase::setDatabaseName()
function, rather than the actual database name.
It's also possible to pass a FILEDSN (*.dsn) filename or a complete
ODBC driver string. When passing a driver string you must make sure,
that all parameters (username, password, ...) are properly escaped.
Passing the username or password through the QSqlDatabase functions,
the escaping is done by the QODBC plugin.
The QODBC Plugin needs an ODBC compliant driver manager version 2.0 or
later. Some ODBC drivers claim to be version-2.0-compliant,