[jbosstools-issues] [JBoss JIRA] Commented: (JBIDE-6396) Filter wizard/Database Collector should correctly identify catalog, schema, and tables even when tables contain dots (".") in the name

Michael Walker (JIRA) jira-events at lists.jboss.org
Fri Jun 4 14:31:25 EDT 2010


    [ https://jira.jboss.org/browse/JBIDE-6396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12534024#action_12534024 ] 

Michael Walker commented on JBIDE-6396:
---------------------------------------

Agreed -- this would break down if the catalog or schema contains dots. For MetaMatrix, it just so happens that only table names can contain dots, so this fix works.

I also agree that a better fix would add quotes around the catalog and schema name to be deterministic. 

And, as you suggest, the very best fix should actually use MetaDataDialect to determine the proper naming, since the implementation of 'dot' and 'quote' can actually be database-specific, and may or may not be supported by the database. 

Ideally, we should be referring to the JDBC methods DatabaseMetadata.getIdentifierQuoteString() to determine the 'quote', and DatabaseMetaData.getCatalogSeparator() to determine the 'dot'. 

SquirrelSQL's source code has one example of how to do it:
http://squirrel-sql.svn.sourceforge.net/viewvc/squirrel-sql/trunk/sql12/fw/src/net/sourceforge/squirrel_sql/fw/sql/DatabaseObjectInfo.java?revision=5102&view=mark


Perhaps we could add a new method to (JDBC)MetaDataDialect to produce the qualified name. Then, JDBCReader would pass the qualified name along to DefaultDatabaseCollection.addTable. AbstractMetaDataDialect does have a "needQuote" method, but it doesn't currently examine the DBMD, nor does it provide the quote character that should be used.

> Filter wizard/Database Collector should correctly identify catalog, schema, and tables even when tables contain dots (".") in the name
> --------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: JBIDE-6396
>                 URL: https://jira.jboss.org/browse/JBIDE-6396
>             Project: Tools (JBoss Tools)
>          Issue Type: Feature Request
>          Components: Hibernate
>    Affects Versions: 3.1.0.GA
>            Reporter: Michael Walker
>            Assignee: Max Rydahl Andersen
>         Attachments: JBIDE-tablename-with-dots-patch-mpw.txt
>
>
> The DefaultDatabaseCollector uses StringHelper.qualifier(String) to determine the catalog and schema name for each table, given the fully-qualified name.
> StringHelper.qualifier() assumes that everything proceeding the final "." in the fully-qualified name represents the qualifier. 
> This assumption breaks down if a table contains a dot in the name. This is found to be the case when working with MetaMatrix (and possibly Teiid). 
> The result is that the Filter Wizard will generate invalid filters, based on the incorrect naming of catalog and schema for each table.
> As a fix, I modified DefaultDatabaseCollector to form the qualifier by using the known catalog and schema, rather than by using the StringHelper.qualifier method. I rebuilt tools and verified that this fixed the problem when working with MetaMatrix.
> This may be better addressed by changing the behavior of StringHelper.qualifier() itself. 
> See forum discussion for details.
> Patch attached.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jbosstools-issues mailing list