Closed ckunki closed 1 year ago
Proposal: VSCJDBC, class BaseColumnMetadataReader
:
protected ResultSet getColumnMetadata(final String catalogName, final String schemaNamePattern,
final String tableNamePattern) throws SQLException {
return this.connection.getMetaData().getColumns(catalogName,
schemaNamePattern, tableNamePattern, ANY_COLUMN);
}
Proposal: VSEXA class ExasolColumnMetadataReader extends BaseColumnMetadataReader
:
@Override
protected ResultSet getColumnMetadata(final String catalogName, final String schemaNamePattern,
final String tableNamePattern) throws SQLException {
return this.connection.getMetaData().getColumns(catalogName,
Wildcards.escape(schemaNamePattern),
Wildcards.escape(tableNamePattern), ANY_COLUMN);
}
Additional fixes | Problem | Fix |
---|---|---|
VSCJDBC also escaped wild cards in the name of the database catalog, conflicting with the parameter's documentation as literal string. | Do not escape potential wild cards in the name of the database catalog. | |
VSCJDBC always used the backslash as escape string, while there are SQL dialects with different escape string, e.g. VSORA using a forward slash / . |
Use java.sql.DatabaseMetaData.getSearchStringEscape() to inquire the escape string for the specific SQL dialect. |
Based on issue #136 VSCJDBC release 10.4.0 introduced escaped wildcards when looking up column metadata which was implemented in
BaseColumnMetadataReader.getColumnMetadata()
.This seems to work fine for exasol-virtual-schema as demonstrated by a related test.
Unfortunately the Oracle JDBC driver seems to deviate from JDBC standard in the way that escaped wildcards in the name of a database schema or a table lead to no matching columns found. So the change introduced with #136 needs to be rolled back for ORAVS and maybe other virtual schemas as well.
See
OracleDatabaseMetaData.html.getColumns()
andgetSearchStringEscape()
The current ticket therefore proposes to make the wildcard escaping optional by providing a method that SQL dialects inheriting from VSCJDBC can override in order to escape wildcards.
Later on