db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "V.Narayanan (JIRA)" <derby-...@db.apache.org>
Subject [jira] Commented: (DERBY-796) jdbc 4.0 specific Blob and Clob method support
Date Wed, 15 Feb 2006 09:52:13 GMT
    [ http://issues.apache.org/jira/browse/DERBY-796?page=comments#action_12366458 ] 

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

Thanx a ton for the reviews and comments.

I have tried to answer the queries raised for this issue. 

Issues Raised and the explanations follow
----------------------------------------------------------------------------

Issue 1
-------------

Change of name of the database from mydb to mydb1
-------------------------------------------------------------------------------------------------

Since I was creating the databases from my code I wanted to give meaningful names to the databases
that I create to test the Embedded and Network JDBC4 code changes. I initially changed it
to mydb1 to check for the run with different databases but missed out on changing the actual
names. I apologize for this mistake I will change this to a more meaningful name say "jdbc4test_database".

Issue 2
-------------

Printing the stack trace
-----------------------------------------

I will do this change and re-submit my patch

Issue 3
-------------

Why was the TestConnection class created?
---------------------------------------------------------------------------------

This class was created during the initial days when I wrote the JDBC4 suite. I understand
that I can do a ij.startJBMS() to get a connection. I notice that doing a ij.getJBMS() from
inside a 1.6 compiled class returns null with no message. Thanx for pointing this David. I
will remove this class and change it the usual way once I fix the ij.startJBMS() bug. I will
raise a JIRA issue for this.

Issue 4
-------------

-        if (offset_ > (blob_.binaryString_.length - blob_.dataOffset_)) {
+        if ((offset_-1) > (blob_.binaryString_.length - blob_.dataOffset_)) { 
-------------------------------------------------------------------------------------------------------------------------------

Sorry for having missed this comment I will do this. 


Issue 5
-------------

--- java/client/org/apache/derby/client/am/Blob.java    (revision 377622)
+++ java/client/org/apache/derby/client/am/Blob.java    (working copy)
@@ -267,7 +267,10 @@

      public int setBytesX(long pos, byte[] bytes, int offset, int len) throws SqlException
{
          int length = 0;
-        if ((int) pos <= 0) {
+        boolean insertIntoEmpty = false;
+    if(pos==1 && binaryString_.length==0)
+        insertIntoEmpty = true;
+        if ((int) pos <= 0 || ((!insertIntoEmpty) && (pos > binaryString_.length
- dataOffset_))) {
              throw new SqlException(agent_.logWriter_,
                  new MessageId(SQLState.BLOB_BAD_POSITION), new Long(pos));
          }

It seemed like the essence of this change was something like:

   "It's usually an error to pass a 'pos' value greater than the
   length of the blob, but if the blob is currently empty then
   there is a special case where the caller passes 1, not 0, as
   you might expect." 

The interpretation above is exactly what I tried to do. I will try to explain what I intended
and also restructure the code to make it more understandable.

There are two cases when exception needs to be thrown

a) when pos <=0
b) when pos > binaryString_.length - dataOffset_
   b.1) This case arises when your insert into a empty Blob. so here pos = 1 and (binaryString_.length
- dataOffset_)=0.
        this should not result in a SQL exception being thrown.

I will split this into two parts by doing this
if(pos<=0)
 Throw an exception
if(pos > binaryString_.length - dataOffset_)
{
	if(Insert in not into an empty Blob)
        {
		Throw an exception
	}
}

Issue - 6
-----------------

it is a cleaner approach to do the conversion from one-based index to zero-based index on
the highest possible level
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Would it be acceptable if I add a proper comment explaining my change for now and raise this
as a seperate issue and fix it at the earliest?

issue - 7
-----------------

ij.startJBMS() throws error
-----------------------------------------------

Thank you for pointing this out. I will raise an issue for this one

issue - 8
----------------

Appearence of unwanted changes as part of diff
--------------------------------------------------------------------------------------

eg
-----

-    public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException {
+    public void setSQLXML(String parameterName, SQLXML xmlObject)
+           throws SQLException { 


I had tried to change the diff to keep to 80 characters per line wherever I noticed a deviation.
The original was 83. I wanted to split it to keep it to 80. If it is felt that this is a distraction
I will change it to the original and submit another patch to make this change.


issue-9
-------------

Appearence of the variable con in ClientDataSource.java

I will remove this.

Thanx once again for the reviews and comments.

Narayanan


> jdbc 4.0 specific Blob and Clob method support
> ----------------------------------------------
>
>          Key: DERBY-796
>          URL: http://issues.apache.org/jira/browse/DERBY-796
>      Project: Derby
>         Type: New Feature
>   Components: JDBC
>     Versions: 10.2.0.0
>  Environment: jdbc 4.0 on all platforms
>     Reporter: V.Narayanan
>     Assignee: V.Narayanan
>     Priority: Minor
>      Fix For: 10.2.0.0
>  Attachments: ClientFramework_Explanation.txt, lob.diff, lob_1.diff, lob_2.diff, lob_3.diff,
lob_4.diff, lob_4.stat
>


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