[
https://issues.apache.org/jira/browse/DDLUTILS-246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12916371#action_12916371
]
Thomas Dudziak commented on DDLUTILS-246:
-----------------------------------------
Tony, I've applied the patch, with a few minor modifications:
* Matcher.quoteReplacement is Java 5, but DdlUtils is (still) Java 1.4, so I've
replaced the call with manual escaping
* There were a few more invocations that use search patterns (e.g.
getForeignKeys, getPrimaryKeys) that I've updated to use the new method
* I've removed the mock DatabaseMetaData class, primarily because new methods
have been added to it in newer JDBC versions which could cause test failures
with specific JDBC drivers; instead I've added a proxy for it, sort of a poor
mans mock
Please have a look and let me know if I missed anything.
> JdbcModelReader merges metadata between tables
> ----------------------------------------------
>
> Key: DDLUTILS-246
> URL: https://issues.apache.org/jira/browse/DDLUTILS-246
> Project: DdlUtils
> Issue Type: Bug
> Components: Core (No specific database)
> Affects Versions: 1.0
> Environment: Java 1.5, Oracle 8/9/10/11, DB2 8/9, MSSQL 2000/2005,
> possibly others
> Reporter: Frank Jakop
> Assignee: Thomas Dudziak
> Priority: Critical
> Attachments: Issue246.patch
>
>
> When reading the columns for a table, JdbcModelReader relies on metadata
> given by DatabaseMetaDataWrapper.
> Given two tables
> TABLE FOO_MATIC (COL1 INTEGER)
> TABLE FOOTMATIC (COL2 INTEGER, COL3 INTEGER)
> the returned columns for table FOO_MATIC is (COL1, COL2, COL3). No need to
> say, that subsequent queries on FOO_MATIC fail due to nonexistent columns
> COL2 and COL3.
> The reason for this behavior is that the underscore is interpreted as a
> wildcard character in DatabaseMetaData.getColumns(String,String), so both
> tables match the pattern FOO_MATIC.
> The workaround I use is to re-check the table name in
> JdbcModelReader.readColumns(DatabaseMetaDataWrapper,String)
> while (columnData.next())
> {
> if (columnData.getString("TABLE_NAME").equals(tableName))
> {
> Map values = readColumns(columnData, getColumnsForColumn());
> columns.add(readColumn(metaData, values));
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.