db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sunitha Kambhampati (JIRA)" <derby-...@db.apache.org>
Subject [jira] Commented: (DERBY-1015) Define interface between network server and engine through Java interfaces.
Date Thu, 29 Jun 2006 00:05:30 GMT
    [ http://issues.apache.org/jira/browse/DERBY-1015?page=comments#action_12418344 ] 

Sunitha Kambhampati commented on DERBY-1015:
--------------------------------------------

Thanks for the feedbac, Dan. 

Looking at this some more, I think it is better to define a new interface for ParameterMetaData
for the following reasons:
-- no need to import a impl class in iapi 
-- this implementation seems clean for use in server. 

So the new interface EnginePreparedStatement will return EngineParameterMetaData instead of
EmbedParameterSetMetaData.

Here are the two interfaces I am proposing:  

NEW INTERFACE: EngineParameterMetaData

/**
 * An internal api only, mainly for use in the network server. 
 * 
 * This interface imitates the ParameterMetaData interface from JDBC3.0
 * We want to provide the ParameterMetaData functionality to JDKs before JDBC3.0. 
 * org.apache.derby.iapi.jdbc.EnginePreparedStatement interface returns an object 
 * of this type on a getEmbedParameterSetMetaData
 * Once,JDK1.3 stops being supported, this interface can be removed and 
 * instead the JDBC 3.0 class ParameterMetaData can be used
 */
public interface EngineParameterMetaData  {
    public int getParameterCount();
    public int isNullable(int param) throws SQLException;
    public boolean isSigned(int param) throws SQLException;
    public int getPrecision(int param) throws SQLException;        
    public int getScale(int param) throws SQLException;
    public int getParameterType(int param) throws SQLException;
    public String getParameterTypeName(int param) throws SQLException;
    public String getParameterClassName(int param) throws SQLException;
    public int getParameterMode(int param) throws SQLException;
    }

(Note: javadoc comments for the methods will be added in the actual patch)

EmbedParameterSetMetaData implements EngineParameterMetaData

-----------------------------------------------------------------------------------------------------------------------------------------------
NEW INTERFACE: EnginePreparedStatement

/**
 * Additional methods the embedded engine exposes on its 
 * PreparedStatement object implementations. An internal api only, mainly 
 * for the network server. Allows consistent interaction between embedded 
 * PreparedStatement and Brokered PreparedStatements.
 * 
 */
public interface EnginePreparedStatement extends PreparedStatement {
    
    /**
     * Immitate the getParameterMetaData() that is in JDBC 3.0
     * Once,JDK1.3 stops being supported, instead of returning EngineParameterMetaData
     * the JDBC 3.0 Class - ParameterMetaData can be used.
     *
     * Retrieves the number, types and properties of this PreparedStatement
     * object's parameters.
     *
     * @return a EngineParameterMetaData object that contains information about the
     * number, types and properties of this PreparedStatement object's parameters.
     * @exception SQLException if a database access error occurs
     */
    public EngineParameterMetaData getEmbedParameterSetMetaData()
        throws SQLException;
    
}

EmbedPreparedStatement implements EnginePreparedStatement
BrokeredPreparedStatement implements EnginePreparedStatement 
--------------------------------------------------------------------------------------------------------------
Thoughts/comments ? Thanks. 

> Define interface between network server and engine through Java interfaces.
> ---------------------------------------------------------------------------
>
>          Key: DERBY-1015
>          URL: http://issues.apache.org/jira/browse/DERBY-1015
>      Project: Derby
>         Type: Improvement

>   Components: JDBC
>     Reporter: Daniel John Debrunner
>     Assignee: Daniel John Debrunner
>      Fix For: 10.2.0.0

>
> API between the network server and engine is not well defined, leading to inconsistent
& multiple ways of handling the different objects returned, such as reflection, explicit
casting etc. This in turn has lead to bugs such as DERBY-966 . DERBY-1005, and DERBY-1006,
and access to underlying objects by the application that should be hidden.
> Define interfaces, such as EngineConnection, that both EmbedConnection and BrokeredConnection
implement. Thus the network server can rely on the fact that any connection it obtains will
implement EngineConnection, and call the required methods through that interface.
> Most likely will need EngineConnection, EnginePreparedStatement and EngineResultSet..
These interfaces would be internal to derby and not exposed to applications.

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


Mime
View raw message