db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Hillegas (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DERBY-3973) Create function wrappers for DatabaseMetaData so that you can join metadata results in queries.
Date Thu, 04 Dec 2008 16:56:44 GMT

     [ https://issues.apache.org/jira/browse/DERBY-3973?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Rick Hillegas updated DERBY-3973:
---------------------------------

    Attachment: DBMDWrapper.java

Attaching DBMDWrapper.java. To use this program:

1) Compile it under Java 6

2) Run the program in order to register the metadata methods as functions in your Derby database.
The program takes one argument, your database URL:

    java DBMDWrapper "jdbc:derby:myDatabase"

3) Note that methods which return ResultSets are registered as table functions. Methods which
return scalar results are registered as scalar functions. Now you can join metadata results
via queries issued in an ij session like this:

 select t.table_schem, t.table_name, c.column_name, c.type_name
 from table( getTables( null, '%', '%' ) ) t,
         table( getColumns( null, '%', '%', '%') ) c
 where c.table_schem = t.table_schem
 and c.table_name = t.table_name
 and t.table_type = 'TABLE'

The program mostly follows the DatabaseMetaData api except for the following issues:

- Boolean arguments and return values were changed from BOOLEAN to SMALLINT.
- Arguments of type int[] and String[] have been eliminated--they are automatically wildcarded.
- The method getRowIdLifetime() has been commented out--Derby does not support object types.
- The method getSchemas(String catalog, String schemaPattern) has been commented out--it can
be uncommented if the registration logic is made smarter to handle the dropping of different
overloads.


As extra credit, this program could be slightly modified so that you could use Derby to run
sophisticated joins against the metadata of other RDBMSes. To do this, you would need to change
the method getDefaultConnection() to return a connection to the foreign RDBMS instead of to
Derby.




> Create function wrappers for DatabaseMetaData so that you can join metadata results in
queries.
> -----------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3973
>                 URL: https://issues.apache.org/jira/browse/DERBY-3973
>             Project: Derby
>          Issue Type: Improvement
>          Components: Demos/Scripts
>    Affects Versions: 10.5.0.0
>            Reporter: Rick Hillegas
>            Assignee: Rick Hillegas
>         Attachments: DBMDWrapper.java
>
>
> Create a program to wrap the DatabaseMetaData methods in Derby functions.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message