db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Øystein Grøvlen (JIRA) <j...@apache.org>
Subject [jira] Updated: (DERBY-2540) Restructure code for Blob/Clob length in client to prepare for locator implementation
Date Thu, 12 Apr 2007 11:21:32 GMT

     [ https://issues.apache.org/jira/browse/DERBY-2540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Øystein Grøvlen updated DERBY-2540:
-----------------------------------

    Attachment: derby-2540.stat
                derby-2540.diff

The attached patch contains the following modifications:

M      java/client/org/apache/derby/client/am/Lob.java
   * Made sqlLength_ and lengthObtained_ private
   * Moved logic from Clob.length() and Blob.length() to sqlLength()
     for checking whether length is already obtained and if not,
     obtain the length by materializing the stream.
   * checkForClosedConnection() was moved to Blob.length() since Clob
     does not currently have the same behavior with respect to closed
     connections, and I do not want to change the behavior with this
     patch.  That will come in later patches.  Also, it should not be
     necessary to this check for closed connections every time the
     length is needed, only when this is a user-initiated operation.
   * Added method setSqlLength() to be used to update the length.
   * Added abstract method materializeStream() so that subclasses can
     do the necessary setup before calling the existing
     materializeStream().

M      java/client/org/apache/derby/client/am/Blob.java
   * Replaced all operations on sqlLength_ with calls to the
     corresponding mehtods in Lob.
   * Replace calls to this.length() with calls to Lob.sqlLength()
     since length() is primarily a function to be called by users, and
     contains code that is not necessary for internal usage.
   * Removed some try-catch blocks that is no longer needed since
     length() is not used.
   * Implemted the new materializeStream() method.

M      java/client/org/apache/derby/client/am/Clob.java
   * Same changes as described for Blob.
   * Remove lengthInBytes_ and getByteLength() as discussed earlier.

M      java/client/org/apache/derby/client/am/BlobOutputStream.java
M      java/client/org/apache/derby/client/am/ClobOutputStream.java
M      java/client/org/apache/derby/client/am/ClobWriter.java
   * Replaced all operations on sqlLength_ with calls to the
     corresponding mehtods in Lob.
   * Refactored common code into a private method to be used by the
     other methods.  This way, I did not have to repeat the same
     changes over and over again.


> Restructure code for Blob/Clob length in client to prepare for locator implementation
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-2540
>                 URL: https://issues.apache.org/jira/browse/DERBY-2540
>             Project: Derby
>          Issue Type: Sub-task
>          Components: Network Client
>            Reporter: Øystein Grøvlen
>         Assigned To: Øystein Grøvlen
>             Fix For: 10.3.0.0
>
>         Attachments: derby-2540.diff, derby-2540.stat
>
>
> In order to prepare for the locator-based implementation, I want to restructure the code
for getting the length of LOBs. 
> Currently, the LOB class has a protected field sqlLength_ that will contain the length
of the LOB, if known.  Currently, it is always known as long as the LOB has been materialized.
 However, when locators are introduced, the length may have to be fetched from the server
the first time it is needed.   With the current implementation, where sqlLength_ is accessed
directly by many classes in the package, it will become very difficult to keep track of whether
one needs to fetch the length from the server or not.
> I will change the implementation to make Lob.sqlLength_ private and add access methods
to get and set its value.  (A good thing in itself IMHO).  If the length is unknown, the LOB
will be materialized to get the length. 

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