[ 
https://issues.apache.org/jira/browse/DERBY-3809?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12759493#action_12759493
 ] 

Knut Anders Hatlen commented on DERBY-3809:
-------------------------------------------

Escaping the schema name sounds like a good idea, since we may make the syntax 
more liberal later. There's a method called IdUtil.normalToDelimited() that 
does this in the embedded driver. Unfortunately, this code cannot be called 
from ij, since derby.jar is not guaranteed to be on the classpath, but you can 
look at the method to see how to escape the identifier. Using a prepared 
statement sounds simpler and cleaner, though, so I think I would have preferred 
that.

One minor issue with the patch: Derby's code uses tab size 4. The patch uses 
spaces for indentation, which is fine, but to match the surrounding code, it 
should use four spaces for each indentation level, not eight.

By the way, JDBC 4.0 has a method in DatabaseMetaData called getFunctions() 
which is similar to the getProcedures() method used by SHOW PROCEDURES. This 
method is implemented in Derby's JDBC 3.0 drivers too, so we may consider using 
that method instead of querying the system tables directly. The benefit of 
using getFunctions() is that it will be more portable and work against other 
databases that have implemented that meta-data call. Since ij is compiled 
against the JDBC 3.0 libraries, we will need to use reflection to call it. I 
think it would be something along these lines:

DatabaseMetaData dbmd = theConnection.getMetaData();
Method getFuncs;
try {
    getFuncs = dbmd.getClass().getMethod("getFunctions", ...);
} catch (NoSuchMethodException nsme) {
    throw new ijException.notAvailableForDriver(...);
}
ResultSet rs = (ResultSet) getFuncs.invoke(dbmd, ...);

> Add a SHOW FUNCTONS command to ij
> ---------------------------------
>
>                 Key: DERBY-3809
>                 URL: https://issues.apache.org/jira/browse/DERBY-3809
>             Project: Derby
>          Issue Type: Improvement
>          Components: Tools
>    Affects Versions: 10.4.1.3
>            Reporter: Rick Hillegas
>            Assignee: Sylvain Leroux
>         Attachments: show-functions.diff
>
>
> Currently, the ij SHOW command can give you information on a number of schema 
> objects, including procedures. It should be fairly easy to add SHOW FUNCTIONS 
> as well. This request surfaced on the user list: 
> http://www.nabble.com/How-can-i-see-my-self-defined-functions--td18773980.html#a18773980

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

Reply via email to