summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Ehrlicher <[email protected]>2023-02-21 17:50:21 +0100
committerQt Cherry-pick Bot <[email protected]>2023-02-22 19:24:23 +0000
commit9e39458a0c820d39567d11d3f2559d84e7dae1f2 (patch)
tree55d8903e2350a4a09a1d1a07f57d786dba42d38d
parente736818cefaea03e717e7417e94dc4abe074e012 (diff)
SQL/OCI: Fix QSQLDriver::record() when tablename is a synonym
Fix the statement when the tablename is a synonym by not appending the where clause for the table name to the initial statement used for tables and synonyms later on. Fixes: QTBUG-111339 Change-Id: Ie18a858427d124e80462048b1a9c5e2afa327546 Reviewed-by: Volker Hilsheimer <[email protected]> (cherry picked from commit 78f7a8c418bc887ebb5bd75f63e35a2b8108f107) Reviewed-by: Qt Cherry-pick Bot <[email protected]>
-rw-r--r--src/plugins/sqldrivers/oci/qsql_oci.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/plugins/sqldrivers/oci/qsql_oci.cpp b/src/plugins/sqldrivers/oci/qsql_oci.cpp
index c33e7582ba3..82bf68143e9 100644
--- a/src/plugins/sqldrivers/oci/qsql_oci.cpp
+++ b/src/plugins/sqldrivers/oci/qsql_oci.cpp
@@ -2554,8 +2554,7 @@ QSqlRecord QOCIDriver::record(const QString& tablename) const
// eg. a sub-query on the sys.synonyms table
QString stmt("select column_name, data_type, data_length, "
"data_precision, data_scale, nullable, data_default%1"
- "from all_tab_columns a "
- "where a.table_name=%2"_L1);
+ "from all_tab_columns a "_L1);
if (d->serverVersion >= 9)
stmt = stmt.arg(", char_length "_L1);
else
@@ -2569,7 +2568,7 @@ QSqlRecord QOCIDriver::record(const QString& tablename) const
else
table = table.toUpper();
- tmpStmt = stmt.arg(u'\'' + table + u'\'');
+ tmpStmt = stmt + "where a.table_name='"_L1 + table + u'\'';
if (owner.isEmpty()) {
owner = d->user;
}