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

Kristian Waagan commented on DERBY-5696:
----------------------------------------

Hi Kim,

The base rule is that you can only access a LOB column once. To access a column 
you invoke a getter on it.
The exceptions to that rule are getBytes and getString, which allow you to 
invoke those two getters as many times as you like, given none of the other 
getters has been invoked already, and additionally one other getter as the last 
invocation.

The reason for the exception to the rule is to avoid breaking existing 
applications that work correctly. getBytes and getString ([1]) are different 
because they always materialize the value. With materialized values you don't 
have the problems with stream positioning that you have [in Derby] when serving 
content off a store stream.

The fact that you can invoke getBytes/getString multiple times is not really an 
important thing to note in the manual. What users need to know is that you can 
only invoke a getter once on a LOB column. If we document the special behavior 
of getBytes/getString, it is to allow user to understand the behavior they are 
seeing in their application. Some users may use/abuse that for convenience - 
that's fine as long as they know their large objects are small object :)

Don't hesitate to ask further questions if my explanation is unclear.


[1] ResultSet.get[Bytes|String] and Blob.getBytes/Clob.getSubString are 
different as the former alway fetch the whole value, whereas the latter allows 
for fetching only parts of the value.
                
> Documentation on LOBs needs some fixes
> --------------------------------------
>
>                 Key: DERBY-5696
>                 URL: https://issues.apache.org/jira/browse/DERBY-5696
>             Project: Derby
>          Issue Type: Bug
>          Components: Documentation
>    Affects Versions: 10.8.2.2
>            Reporter: Kim Haase
>            Assignee: Kim Haase
>
> DERBY-5489 points out some issues with multiple getXXX calls on LOBs that are 
> not fully documented. The information should probably be added to "Notes on 
> mapping of java.sql.Blob and java.sql.Clob interfaces". In addition, the 
> topic "Mapping of java.sql.Blob and java.sql.Clob interfaces" has a typo and 
> could probably use some additional information as well.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to