You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Kristian Waagan (JIRA)" <ji...@apache.org> on 2010/01/15 13:49:57 UTC

[jira] Created: (DERBY-4515) Document and clarify the use of DataValueDescriptor.setValue(InputStream,int)

Document and clarify the use of DataValueDescriptor.setValue(InputStream,int)
-----------------------------------------------------------------------------

                 Key: DERBY-4515
                 URL: https://issues.apache.org/jira/browse/DERBY-4515
             Project: Derby
          Issue Type: Improvement
          Components: JDBC
    Affects Versions: 10.6.0.0
            Reporter: Kristian Waagan
            Assignee: Kristian Waagan
            Priority: Minor
             Fix For: 10.6.0.0


The usage of the method DataValueDescriptor.setValue(InputStream stream, int length) is unclear. The intended use seems to be to pass on the known length of an input stream set from the JDBC-layer (i.e. setBinaryStream).
There seems to be two distinct cases:
 - the logical length of the stream is known
 - the logical length of the stream is not known

Using -1 when the length is not known seems to be an established pattern.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-4515) Document and clarify the use of DataValueDescriptor.setValue(InputStream,int)

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4515?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12802864#action_12802864 ] 

Knut Anders Hatlen commented on DERBY-4515:
-------------------------------------------

The patch looks like an improvement to me too. +1 to commit.

> Document and clarify the use of DataValueDescriptor.setValue(InputStream,int)
> -----------------------------------------------------------------------------
>
>                 Key: DERBY-4515
>                 URL: https://issues.apache.org/jira/browse/DERBY-4515
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>    Affects Versions: 10.6.0.0
>            Reporter: Kristian Waagan
>            Assignee: Kristian Waagan
>            Priority: Minor
>             Fix For: 10.6.0.0
>
>         Attachments: derby-4515-1a-setValue_stream_clarification.diff, derby-4515-1a-setValue_stream_clarification.stat
>
>
> The usage of the method DataValueDescriptor.setValue(InputStream stream, int length) is unclear. The intended use seems to be to pass on the known length of an input stream set from the JDBC-layer (i.e. setBinaryStream).
> There seems to be two distinct cases:
>  - the logical length of the stream is known
>  - the logical length of the stream is not known
> Using -1 when the length is not known seems to be an established pattern.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-4515) Document and clarify the use of DataValueDescriptor.setValue(InputStream,int)

Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4515?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kristian Waagan updated DERBY-4515:
-----------------------------------

    Attachment: derby-4515-1a-setValue_stream_clarification.stat
                derby-4515-1a-setValue_stream_clarification.diff

Patch 1a cleans up the usage of DataValueDescriptor.setValue(InputStream,int) with the following changes:

* DataValueDescriptor
Added constant UNKNOWN_LOGICAL_LENGTH (has value -1).
Improved JavaDoc for the method setValue(InputStream,int).

* EmbedResultSet
Used new constant to indicate unknown length.
Removed inaccurate comment stating the length variable isn't used.

* EmbedPreparedStatement
Used new constant to indicate unknown length.
Removed false comment (already wrong, but got even worse after the fix below).
Removed unneeded variable 'intLength'.

* SQLChar & SQLBinary
Added mention of the new constant in the JavaDoc for the setValue method.

Regression tests passed.
Patch ready for review.

An alternative to the patch, or maybe even follow-up work, is to investigate if the length argument is really needed. Most of the usage seem to be related to getting data into Derby, but there are *indications* that in some cases it is used when dealing with streams coming from the store as well (or maybe when passing between different parts of the system).
Given that most of the patch is documentation and trivial changes, I think it is incremental improvement in any case.

> Document and clarify the use of DataValueDescriptor.setValue(InputStream,int)
> -----------------------------------------------------------------------------
>
>                 Key: DERBY-4515
>                 URL: https://issues.apache.org/jira/browse/DERBY-4515
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>    Affects Versions: 10.6.0.0
>            Reporter: Kristian Waagan
>            Assignee: Kristian Waagan
>            Priority: Minor
>             Fix For: 10.6.0.0
>
>         Attachments: derby-4515-1a-setValue_stream_clarification.diff, derby-4515-1a-setValue_stream_clarification.stat
>
>
> The usage of the method DataValueDescriptor.setValue(InputStream stream, int length) is unclear. The intended use seems to be to pass on the known length of an input stream set from the JDBC-layer (i.e. setBinaryStream).
> There seems to be two distinct cases:
>  - the logical length of the stream is known
>  - the logical length of the stream is not known
> Using -1 when the length is not known seems to be an established pattern.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-4515) Document and clarify the use of DataValueDescriptor.setValue(InputStream,int)

Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4515?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kristian Waagan updated DERBY-4515:
-----------------------------------

    Issue & fix info: [Patch Available]

> Document and clarify the use of DataValueDescriptor.setValue(InputStream,int)
> -----------------------------------------------------------------------------
>
>                 Key: DERBY-4515
>                 URL: https://issues.apache.org/jira/browse/DERBY-4515
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>    Affects Versions: 10.6.0.0
>            Reporter: Kristian Waagan
>            Assignee: Kristian Waagan
>            Priority: Minor
>             Fix For: 10.6.0.0
>
>         Attachments: derby-4515-1a-setValue_stream_clarification.diff, derby-4515-1a-setValue_stream_clarification.stat
>
>
> The usage of the method DataValueDescriptor.setValue(InputStream stream, int length) is unclear. The intended use seems to be to pass on the known length of an input stream set from the JDBC-layer (i.e. setBinaryStream).
> There seems to be two distinct cases:
>  - the logical length of the stream is known
>  - the logical length of the stream is not known
> Using -1 when the length is not known seems to be an established pattern.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (DERBY-4515) Document and clarify the use of DataValueDescriptor.setValue(InputStream,int)

Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4515?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kristian Waagan closed DERBY-4515.
----------------------------------

          Resolution: Fixed
       Fix Version/s: 10.5.3.1
    Issue & fix info:   (was: [Patch Available])

Committed to trunk with revision 901648, and back-ported to the 10.5 branch with revision 901651.

I'm closing the issue. Thank you for the feedback.

> Document and clarify the use of DataValueDescriptor.setValue(InputStream,int)
> -----------------------------------------------------------------------------
>
>                 Key: DERBY-4515
>                 URL: https://issues.apache.org/jira/browse/DERBY-4515
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>    Affects Versions: 10.6.0.0
>            Reporter: Kristian Waagan
>            Assignee: Kristian Waagan
>            Priority: Minor
>             Fix For: 10.5.3.1, 10.6.0.0
>
>         Attachments: derby-4515-1a-setValue_stream_clarification.diff, derby-4515-1a-setValue_stream_clarification.stat
>
>
> The usage of the method DataValueDescriptor.setValue(InputStream stream, int length) is unclear. The intended use seems to be to pass on the known length of an input stream set from the JDBC-layer (i.e. setBinaryStream).
> There seems to be two distinct cases:
>  - the logical length of the stream is known
>  - the logical length of the stream is not known
> Using -1 when the length is not known seems to be an established pattern.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.