db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Øystein Grøvlen (JIRA) <derby-...@db.apache.org>
Subject [jira] Commented: (DERBY-1292) ClassCastException in ClientDriver when using CLOB columns and batch updates
Date Wed, 23 Aug 2006 14:06:15 GMT
    [ http://issues.apache.org/jira/browse/DERBY-1292?page=comments#action_12430012 ] 
            
Øystein Grøvlen commented on DERBY-1292:
----------------------------------------

Thanks, for working on this patch

I have verified that the patch works, but I am a bit concerned with
the copying overhead this patch introduces.  The entire ColumnMetaData
is copied, but it is only clientParamterType that will be changing
between statements of a batch.  It should be sufficient to copy just
this array.  (IMO, this is an indication that clientParamterType
should not have been part of ColumnMetaData in the first place.
Almost all of the data in ColumnMetaData is received from the server
as part of a prepare and that data is never changed by the client.
clientParamterType (note the typo) on the other hand is set by the
client between executions or for each statement of a batch. It would
have been best if these two issues were separated, but I guess that is
a bit beyond what one can expect from a bug fix.)

To the implementation:

1. I suggest making a list of just clientParamterType arrays, not
   ColumnMetadata.

2. I suggest not allocating this list until it is actually needed.
   (No need to pay a penalty for clients not using batches.)  That is,
   in addBatch do:
      if (parameterTypeList == null) { 
          parameterTypeList = new ArrayList();
      }

3. Since clientParamterType is an int[], a shallow copy is sufficient.
   Hence, there should be no need for a separate copy method. Instead,
   you can just do:
      parameterTypeList.add(parameterMetaData.clientParamtertype_.clone());

4. Since the same bug exists in the IBM driver, your new test will
   fail when running with this driver.  You can disable your test for
   this framework by this if-test:
       if (!TestUtil.isJCCFramework()) { jira1292test(); }

5. I am not that fond of test names with bug numbers.  I would prefer
   a name that described what was tested, but I see that bug numbers
   is the pattern for this test, so I will not demand that you change
   this.  (However, it is not very useful when the code refers to bug
   reports in a system that is no longer in use.)  At least, add a
   comment explaining what you are testing.

6. I would think it would be useful to execute your test case also in
   an embedded context.  Hence, I suggest to add it to the
   jdbcapi/batchUpdate.java test instead.  That way, derbyall will run
   the test case in both embedded and client/server.

7. Nit pick: You have a comment line that is a bit above 80 characters.


> ClassCastException in ClientDriver when using CLOB columns and batch updates
> ----------------------------------------------------------------------------
>
>                 Key: DERBY-1292
>                 URL: http://issues.apache.org/jira/browse/DERBY-1292
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Client
>    Affects Versions: 10.1.2.1
>            Reporter: Gerald Khin
>         Assigned To: James F. Adams
>         Attachments: DERBY-1292.diff
>
>
> java.lang.ClassCastException: java.lang.String
> 	at org.apache.derby.client.net.NetStatementRequest.computeProtocolTypesAndLengths(Unknown
Source)
> 	at org.apache.derby.client.net.NetStatementRequest.buildSQLDTAcommandData(Unknown Source)
> 	at org.apache.derby.client.net.NetStatementRequest.writeExecute(Unknown Source)
> 	at org.apache.derby.client.net.NetPreparedStatement.writeExecute_(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.writeExecute(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.executeBatchRequestX(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.executeBatchX(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.executeBatch(Unknown Source)
> 	at CCEBatchUpdateRepro.doInserts(CCEBatchUpdateRepro.java:71)
> 	at CCEBatchUpdateRepro.main(CCEBatchUpdateRepro.java:27)

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