summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx16
1 files changed, 12 insertions, 4 deletions
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx b/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx
index 507ce0b91e45..bd58d9cb1f5e 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx
@@ -696,12 +696,12 @@ Reference<XResultSet>
}
Reference<XResultSet> SAL_CALL ODatabaseMetaData::getColumns(const Any& /*catalog*/,
- const OUString& /*schemaPattern*/,
+ const OUString& schemaPattern,
const OUString& tableNamePattern,
const OUString& columnNamePattern)
{
- OUStringBuffer queryBuf("SELECT TABLE_CATALOG AS TABLE_CAT, " // 1
- "TABLE_SCHEMA AS TABLE_SCHEM, " // 2
+ OUStringBuffer queryBuf("SELECT TABLE_CATALOG, " // 1
+ "TABLE_SCHEMA, " // 2
"TABLE_NAME, " // 3
"COLUMN_NAME, " // 4
"DATA_TYPE, " // 5
@@ -720,7 +720,6 @@ Reference<XResultSet> SAL_CALL ODatabaseMetaData::getColumns(const Any& /*catalo
"COLUMN_TYPE " // 14
"FROM INFORMATION_SCHEMA.COLUMNS "
"WHERE (1 = 1) ");
-
if (!tableNamePattern.isEmpty())
{
OUString sAppend;
@@ -730,6 +729,15 @@ Reference<XResultSet> SAL_CALL ODatabaseMetaData::getColumns(const Any& /*catalo
sAppend = "AND TABLE_NAME = '%' ";
queryBuf.append(sAppend.replaceAll("%", tableNamePattern));
}
+ if (!schemaPattern.isEmpty())
+ {
+ OUString sAppend;
+ if (tableNamePattern.match("%"))
+ sAppend = "AND TABLE_SCHEMA LIKE '%' ";
+ else
+ sAppend = "AND TABLE_SCHEMA = '%' ";
+ queryBuf.append(sAppend.replaceAll("%", schemaPattern));
+ }
if (!columnNamePattern.isEmpty())
{
OUString sAppend;