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 "Knut Anders Hatlen (JIRA)" <de...@db.apache.org> on 2006/07/18 11:52:15 UTC

[jira] Created: (DERBY-1527) Factor out type checks in EmbedResultSet and EmbedPreparedStatement

Factor out type checks in EmbedResultSet and EmbedPreparedStatement
-------------------------------------------------------------------

                 Key: DERBY-1527
                 URL: http://issues.apache.org/jira/browse/DERBY-1527
             Project: Derby
          Issue Type: Improvement
          Components: JDBC
    Affects Versions: 10.2.0.0
            Reporter: Knut Anders Hatlen


EmbedPreparedStatement and EmbedResultSet have many occurrences of

    switch (...) {
        case Types.CHAR:
        case Types.VARCHAR:
        case Types.LONGVARCHAR:
        case Types.CLOB:
            break;
        default:
            throw dataTypeConversion(...);
    }

and

    switch (...) {
        case Types.BINARY:
        case Types.VARBINARY:
        case Types.LONGVARBINARY:
        case Types.BLOB:
            break;
        default:
            throw dataTypeConversion(...);
    }

Instead of having many copies of this code, it would be good to factor
it out into methods that can be shared. For instance, one could add
these methods to DataTypeDescriptor:

  public static boolean isAsciiStreamCompatible(int jdbcType)
  public static boolean isBinaryStreamCompatible(int jdbcType)
  public static boolean isCharacterStreamCompatible(int jdbcType)

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

        

[jira] Updated: (DERBY-1527) Factor out type checks in EmbedResultSet and EmbedPreparedStatement

Posted by "Knut Anders Hatlen (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-1527?page=all ]

Knut Anders Hatlen updated DERBY-1527:
--------------------------------------

    Priority: Minor  (was: Major)

> Factor out type checks in EmbedResultSet and EmbedPreparedStatement
> -------------------------------------------------------------------
>
>                 Key: DERBY-1527
>                 URL: http://issues.apache.org/jira/browse/DERBY-1527
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>    Affects Versions: 10.2.0.0
>            Reporter: Knut Anders Hatlen
>            Priority: Minor
>
> EmbedPreparedStatement and EmbedResultSet have many occurrences of
>     switch (...) {
>         case Types.CHAR:
>         case Types.VARCHAR:
>         case Types.LONGVARCHAR:
>         case Types.CLOB:
>             break;
>         default:
>             throw dataTypeConversion(...);
>     }
> and
>     switch (...) {
>         case Types.BINARY:
>         case Types.VARBINARY:
>         case Types.LONGVARBINARY:
>         case Types.BLOB:
>             break;
>         default:
>             throw dataTypeConversion(...);
>     }
> Instead of having many copies of this code, it would be good to factor
> it out into methods that can be shared. For instance, one could add
> these methods to DataTypeDescriptor:
>   public static boolean isAsciiStreamCompatible(int jdbcType)
>   public static boolean isBinaryStreamCompatible(int jdbcType)
>   public static boolean isCharacterStreamCompatible(int jdbcType)

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

        

[jira] Updated: (DERBY-1527) Factor out type checks in EmbedResultSet and EmbedPreparedStatement

Posted by "Knut Anders Hatlen (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-1527?page=all ]

Knut Anders Hatlen updated DERBY-1527:
--------------------------------------

    Attachment: derby-1527-v1.diff
                derby-1527-v1.stat

Attached is a patch which factors out the type checks from the set*Stream methods in EmbedPreparedStatement and the update*Stream methods in EmbedResultSet. Three new static methods were added to DataTypeDescriptor: isAsciiStreamAssignable(), isBinaryStreamAssignable() and isCharacterStreamAssignable(). These methods return true if a column or parameter of the specified type could be updated/set with an ascii stream, a binary stream or a character stream, respectively. Derbyall runs cleanly.

> Factor out type checks in EmbedResultSet and EmbedPreparedStatement
> -------------------------------------------------------------------
>
>                 Key: DERBY-1527
>                 URL: http://issues.apache.org/jira/browse/DERBY-1527
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>    Affects Versions: 10.2.0.0
>            Reporter: Knut Anders Hatlen
>         Assigned To: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: derby-1527-v1.diff, derby-1527-v1.stat
>
>
> EmbedPreparedStatement and EmbedResultSet have many occurrences of
>     switch (...) {
>         case Types.CHAR:
>         case Types.VARCHAR:
>         case Types.LONGVARCHAR:
>         case Types.CLOB:
>             break;
>         default:
>             throw dataTypeConversion(...);
>     }
> and
>     switch (...) {
>         case Types.BINARY:
>         case Types.VARBINARY:
>         case Types.LONGVARBINARY:
>         case Types.BLOB:
>             break;
>         default:
>             throw dataTypeConversion(...);
>     }
> Instead of having many copies of this code, it would be good to factor
> it out into methods that can be shared. For instance, one could add
> these methods to DataTypeDescriptor:
>   public static boolean isAsciiStreamCompatible(int jdbcType)
>   public static boolean isBinaryStreamCompatible(int jdbcType)
>   public static boolean isCharacterStreamCompatible(int jdbcType)

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

        

[jira] Updated: (DERBY-1527) Factor out type checks in EmbedResultSet and EmbedPreparedStatement

Posted by "Knut Anders Hatlen (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-1527?page=all ]

Knut Anders Hatlen updated DERBY-1527:
--------------------------------------

    Derby Info: [Patch Available]

> Factor out type checks in EmbedResultSet and EmbedPreparedStatement
> -------------------------------------------------------------------
>
>                 Key: DERBY-1527
>                 URL: http://issues.apache.org/jira/browse/DERBY-1527
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>    Affects Versions: 10.2.0.0
>            Reporter: Knut Anders Hatlen
>         Assigned To: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: derby-1527-v1.diff, derby-1527-v1.stat
>
>
> EmbedPreparedStatement and EmbedResultSet have many occurrences of
>     switch (...) {
>         case Types.CHAR:
>         case Types.VARCHAR:
>         case Types.LONGVARCHAR:
>         case Types.CLOB:
>             break;
>         default:
>             throw dataTypeConversion(...);
>     }
> and
>     switch (...) {
>         case Types.BINARY:
>         case Types.VARBINARY:
>         case Types.LONGVARBINARY:
>         case Types.BLOB:
>             break;
>         default:
>             throw dataTypeConversion(...);
>     }
> Instead of having many copies of this code, it would be good to factor
> it out into methods that can be shared. For instance, one could add
> these methods to DataTypeDescriptor:
>   public static boolean isAsciiStreamCompatible(int jdbcType)
>   public static boolean isBinaryStreamCompatible(int jdbcType)
>   public static boolean isCharacterStreamCompatible(int jdbcType)

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

        

[jira] Assigned: (DERBY-1527) Factor out type checks in EmbedResultSet and EmbedPreparedStatement

Posted by "Knut Anders Hatlen (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-1527?page=all ]

Knut Anders Hatlen reassigned DERBY-1527:
-----------------------------------------

    Assignee: Knut Anders Hatlen

> Factor out type checks in EmbedResultSet and EmbedPreparedStatement
> -------------------------------------------------------------------
>
>                 Key: DERBY-1527
>                 URL: http://issues.apache.org/jira/browse/DERBY-1527
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>    Affects Versions: 10.2.0.0
>            Reporter: Knut Anders Hatlen
>         Assigned To: Knut Anders Hatlen
>            Priority: Minor
>
> EmbedPreparedStatement and EmbedResultSet have many occurrences of
>     switch (...) {
>         case Types.CHAR:
>         case Types.VARCHAR:
>         case Types.LONGVARCHAR:
>         case Types.CLOB:
>             break;
>         default:
>             throw dataTypeConversion(...);
>     }
> and
>     switch (...) {
>         case Types.BINARY:
>         case Types.VARBINARY:
>         case Types.LONGVARBINARY:
>         case Types.BLOB:
>             break;
>         default:
>             throw dataTypeConversion(...);
>     }
> Instead of having many copies of this code, it would be good to factor
> it out into methods that can be shared. For instance, one could add
> these methods to DataTypeDescriptor:
>   public static boolean isAsciiStreamCompatible(int jdbcType)
>   public static boolean isBinaryStreamCompatible(int jdbcType)
>   public static boolean isCharacterStreamCompatible(int jdbcType)

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

        

[jira] Closed: (DERBY-1527) Factor out type checks in EmbedResultSet and EmbedPreparedStatement

Posted by "Knut Anders Hatlen (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-1527?page=all ]

Knut Anders Hatlen closed DERBY-1527.
-------------------------------------

    Fix Version/s: 10.2.0.0
       Resolution: Fixed
       Derby Info:   (was: [Patch Available])

Thanks for the review, Kristian. I think jdbcapi/parameterMapping.java tests data types for setXXX and getXXX methods (but not updateXXX).

Committed revision 423912.

> Factor out type checks in EmbedResultSet and EmbedPreparedStatement
> -------------------------------------------------------------------
>
>                 Key: DERBY-1527
>                 URL: http://issues.apache.org/jira/browse/DERBY-1527
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>    Affects Versions: 10.2.0.0
>            Reporter: Knut Anders Hatlen
>         Assigned To: Knut Anders Hatlen
>            Priority: Minor
>             Fix For: 10.2.0.0
>
>         Attachments: derby-1527-v1.diff, derby-1527-v1.stat
>
>
> EmbedPreparedStatement and EmbedResultSet have many occurrences of
>     switch (...) {
>         case Types.CHAR:
>         case Types.VARCHAR:
>         case Types.LONGVARCHAR:
>         case Types.CLOB:
>             break;
>         default:
>             throw dataTypeConversion(...);
>     }
> and
>     switch (...) {
>         case Types.BINARY:
>         case Types.VARBINARY:
>         case Types.LONGVARBINARY:
>         case Types.BLOB:
>             break;
>         default:
>             throw dataTypeConversion(...);
>     }
> Instead of having many copies of this code, it would be good to factor
> it out into methods that can be shared. For instance, one could add
> these methods to DataTypeDescriptor:
>   public static boolean isAsciiStreamCompatible(int jdbcType)
>   public static boolean isBinaryStreamCompatible(int jdbcType)
>   public static boolean isCharacterStreamCompatible(int jdbcType)

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

        

[jira] Commented: (DERBY-1527) Factor out type checks in EmbedResultSet and EmbedPreparedStatement

Posted by "Kristian Waagan (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-1527?page=comments#action_12422375 ] 
            
Kristian Waagan commented on DERBY-1527:
----------------------------------------

I reviewed the patch, and it looks ready for commit.

The patch applies, no build failures, and I ran the jdbc40 suite as a sanity check (no failures for embedded).

Do we have any tests for checking which set/update-methods can be used on the various datatypes?
If not, we ought to create a Jira for making one.


Thank you for doing this clean-up.

> Factor out type checks in EmbedResultSet and EmbedPreparedStatement
> -------------------------------------------------------------------
>
>                 Key: DERBY-1527
>                 URL: http://issues.apache.org/jira/browse/DERBY-1527
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>    Affects Versions: 10.2.0.0
>            Reporter: Knut Anders Hatlen
>         Assigned To: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: derby-1527-v1.diff, derby-1527-v1.stat
>
>
> EmbedPreparedStatement and EmbedResultSet have many occurrences of
>     switch (...) {
>         case Types.CHAR:
>         case Types.VARCHAR:
>         case Types.LONGVARCHAR:
>         case Types.CLOB:
>             break;
>         default:
>             throw dataTypeConversion(...);
>     }
> and
>     switch (...) {
>         case Types.BINARY:
>         case Types.VARBINARY:
>         case Types.LONGVARBINARY:
>         case Types.BLOB:
>             break;
>         default:
>             throw dataTypeConversion(...);
>     }
> Instead of having many copies of this code, it would be good to factor
> it out into methods that can be shared. For instance, one could add
> these methods to DataTypeDescriptor:
>   public static boolean isAsciiStreamCompatible(int jdbcType)
>   public static boolean isBinaryStreamCompatible(int jdbcType)
>   public static boolean isCharacterStreamCompatible(int jdbcType)

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