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] [Commented] (DERBY-6264) Improve test coverage of org.apache.derby.iapi.db.PropertyInfo
Date Tue, 18 Jun 2013 13:19:20 GMT

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

Rick Hillegas commented on DERBY-6264:
--------------------------------------

Concerning PropertyInfo: The header comment of this class uses the term "SQL-J". That was
the original name for the Cloudscape SQL dialect fifteen years ago. That suggests that this
code is very old indeed. According to the header comment, the methods are meant to be called
by user-written functions and procedures.

At one point you could have registered these methods as functions. However, due to DERBY-2330,
you can't do that anymore. Nevertheless, you can subvert the intent of DERBY-2330 by writing
your own static methods which forward to the PropertyInfo methods. E.g., you could write this
class...

import java.sql.SQLException;
import java.util.Properties;
import org.apache.derby.iapi.db.PropertyInfo;

public  class   zz
{
    public  static  Properties  getTableProperties( String schemaName, String tableName )
        throws SQLException
    {
        return PropertyInfo.getTableProperties( schemaName, tableName );
    }
}

...and then run this ij script...

connect 'jdbc:derby:memory:db;create=true';

create type Properties external name 'java.util.Properties' language java;

create function getTableProperties( schemaName varchar( 32672 ), tableName varchar( 32672
) )
returns Properties
language java parameter style java contains sql
external name 'zz.getTableProperties';

values getTableProperties( 'SYS', 'SYSTABLES' );

But PropertyInfo is not part of the public api. Whatever guarantees Cloudscape might have
given, Derby does not support the use of these methods by customer-written code. I would be
comfortable with either of the following options:

i) Remove the unused methods.

ii) Write JUnit tests which register and exercise the wrapping functions, as shown above.

Thanks,
-Rick

                
> Improve test coverage of org.apache.derby.iapi.db.PropertyInfo
> --------------------------------------------------------------
>
>                 Key: DERBY-6264
>                 URL: https://issues.apache.org/jira/browse/DERBY-6264
>             Project: Derby
>          Issue Type: Sub-task
>          Components: Test
>            Reporter: Bryan Pendleton
>            Assignee: ahsan shamsudeen
>            Priority: Minor
>
> According to the coverage reports, only 1 of the 5 methods in
> org.apache.derby.iapi.db.PropertyInfo is exercised by the Derby
> regression tests.
> This sub-task is to improve that test coverage.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message