db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "V.Narayanan (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-2257) Implementing the stored procedures called by the LOB related JDBC methods
Date Tue, 06 Mar 2007 05:10:24 GMT

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

V.Narayanan commented on DERBY-2257:
------------------------------------

- In previous versions of the patch the methods in BrokeredConnection forwarded calls to the
underlying connection, but in v6 these methods are empty. Was that an intended change? 

yes, sorry about not explaining it in the comments. All Brokered calls are forwarded to the
rootConnection. Hence it wasn't necessary to have an implementation for these methods here

- Some of the test cases test that certain statements fail. Wouldn't it be better if they
used assertSQLState() to make sure the failures are the ones we expect?

The test cases that test for failure are in the ClobStoredProcedureTest class. All of them
can be explained by considering the following example. The explanation follows the code snippet.

       String str = "This is a test string";
        int locator = 0;
        getConnection().setAutoCommit(false);
        CallableStatement cs  = getConnection().prepareCall
            ("? = CALL SYSIBM.CLOBCREATELOCATOR()");
        cs.registerOutParameter(1,java.sql.Types.INTEGER);
        cs.executeUpdate();
        locator = cs.getInt(1);
        
        cs  = getConnection().
            prepareCall("CALL SYSIBM.CLOBSETSTRING(?,?,?,?)");
        cs.setInt(1,locator);
        cs.setInt(2,1);
        cs.setLong(3,str.length());
        cs.setString(4,str);
        try {
            cs.execute();
        }
        catch(SQLException sqle) {
            while(sqle != null) {
                System.out.println(sqle.getSQLState());
                sqle=sqle.getNextException();
            }
        }

CLOBSETSTRING internally calls Clob.setString. This is notImplemented but as explained in
my comments I have added temporary code here to create a Clob for the purpose of testing my
stored procedures.

This is expected to throw an Not Implemented exception (has a SQLState of 0A000)

In the above exercise I have tried to go through the exception chain to determine the SQLState
something like what assertSQLState does in order to determine of any of the chained exceptions
have the SQLState it expects.

In the embedded case my output is this

38000
0A000

In the Network Client case my output is this

38000

I haven't been able to dig deeper into this discrepancy in expected SQLStates. I will do further
investigation into this. 

Also the code in which I check for the SQLException is temporary and will be removed once
the Clob locator methods are added.

Hence I decided to retain it the same way.

Thank you for the review. I am attaching a patch addressing the other issues you have pointed.

Narayanan



> Implementing the stored procedures called by the LOB related JDBC methods
> -------------------------------------------------------------------------
>
>                 Key: DERBY-2257
>                 URL: https://issues.apache.org/jira/browse/DERBY-2257
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>         Environment: All environments
>            Reporter: V.Narayanan
>         Assigned To: V.Narayanan
>         Attachments: Expln_StoredProc_LOB.txt, Expln_StoredProc_LOB_v2.txt, StoredProcedure_v3.diff,
StoredProcedure_v3.stat, StoredProcedure_v4.diff, StoredProcedure_v4.stat, StoredProcedure_v5.diff,
StoredProcedure_v5.stat, StoredProcedure_v6.diff, StoredProcedure_v6.stat, StoredProcedures_v1.diff,
StoredProcedures_v1.stat, StoredProcedures_v2.diff, StoredProcedures_v2.stat
>
>


-- 
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