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 "Rick Hillegas (JIRA)" <ji...@apache.org> on 2010/05/17 17:00:43 UTC

[jira] Created: (DERBY-4663) Write a regression test to verify the behavior of ResultSet.getBoolean()

Write a regression test to verify the behavior of ResultSet.getBoolean()
------------------------------------------------------------------------

                 Key: DERBY-4663
                 URL: https://issues.apache.org/jira/browse/DERBY-4663
             Project: Derby
          Issue Type: Improvement
          Components: JDBC, Test
    Affects Versions: 10.7.0.0
            Reporter: Rick Hillegas


The JDBC spec partially defines the expected behavior of ResultSet.getBoolean(). It would be good to have a regression test which tracks Derby's actual implementation. For the moment, it appears that Derby conforms to the defined behavior, does something reasonable in the undefined cases, and behaves the same way in the embedded and client drivers.

The behavior of ResultSet.getBoolean() does not appear to have been defined until JDBC 4. Here is the JDBC 4 javadoc:

"If the designated column has a datatype of CHAR or VARCHAR and contains a "0" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or BIGINT and contains a 0, a value of false is returned. If the designated column has a datatype of CHAR or VARCHAR and contains a "1" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or BIGINT and contains a 1, a value of true is returned." 

The behavior for those datatypes is not specified if the actual value is not 0 or 1. However, in a private communication I have the following statement of intent from Lance Andersen, the JDBC spec lead:

"Note: Please refer to your driver documentation for the return value when the designated column contains a values other than "0", 0, "1" or 1."

In addition, the behavior for other datatypes is not specified. Some day it might be good if Derby's documentation described our behavior in the unspecified cases. Here it is:

1) ResultSet.getBoolean() on LONG VARCHAR behaves like CHAR and VARCHAR

2) ResultSet.getBoolean() on DECIMAL, REAL, DOUBLE, and NUMERIC behaves like INTEGER.

3) Derby raises an exception if you call ResultSet.getBoolean() on BLOB, CHAR FOR BIT DATA, CLOB, DATE, LONG VARCHAR FOR BIT DATA, TIME, TIMESTAMP, or VARCHAR FOR BIT DATA.

4) You can't even directly select an XML value.


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


[jira] Assigned: (DERBY-4663) Write a regression test to verify the behavior of ResultSet.getBoolean()

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

Rick Hillegas reassigned DERBY-4663:
------------------------------------

    Assignee: Rick Hillegas

> Write a regression test to verify the behavior of ResultSet.getBoolean()
> ------------------------------------------------------------------------
>
>                 Key: DERBY-4663
>                 URL: https://issues.apache.org/jira/browse/DERBY-4663
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC, Test
>    Affects Versions: 10.7.0.0
>            Reporter: Rick Hillegas
>            Assignee: Rick Hillegas
>
> The JDBC spec partially defines the expected behavior of ResultSet.getBoolean(). It would be good to have a regression test which tracks Derby's actual implementation. For the moment, it appears that Derby conforms to the defined behavior, does something reasonable in the undefined cases, and behaves the same way in the embedded and client drivers.
> The behavior of ResultSet.getBoolean() does not appear to have been defined until JDBC 4. Here is the JDBC 4 javadoc:
> "If the designated column has a datatype of CHAR or VARCHAR and contains a "0" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or BIGINT and contains a 0, a value of false is returned. If the designated column has a datatype of CHAR or VARCHAR and contains a "1" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or BIGINT and contains a 1, a value of true is returned." 
> The behavior for those datatypes is not specified if the actual value is not 0 or 1. However, in a private communication I have the following statement of intent from Lance Andersen, the JDBC spec lead:
> "Note: Please refer to your driver documentation for the return value when the designated column contains a values other than "0", 0, "1" or 1."
> In addition, the behavior for other datatypes is not specified. Some day it might be good if Derby's documentation described our behavior in the unspecified cases. Here it is:
> 1) ResultSet.getBoolean() on LONG VARCHAR behaves like CHAR and VARCHAR
> 2) ResultSet.getBoolean() on DECIMAL, REAL, DOUBLE, and NUMERIC behaves like INTEGER.
> 3) Derby raises an exception if you call ResultSet.getBoolean() on BLOB, CHAR FOR BIT DATA, CLOB, DATE, LONG VARCHAR FOR BIT DATA, TIME, TIMESTAMP, or VARCHAR FOR BIT DATA.
> 4) You can't even directly select an XML value.

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


[jira] Updated: (DERBY-4663) Write a regression test to verify the behavior of ResultSet.getBoolean()

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

Rick Hillegas updated DERBY-4663:
---------------------------------

    Attachment: derby-4663-01-aa-regressionTest.diff

Attaching derby-4663-01-aa-regressionTest.diff. This patch adds a regression test to track the behavior of ResultSet.getBoolean() in the embedded and client drivers. Committed at subversion revision 945197.

Touches the following files:

A      java/testing/org/apache/derbyTesting/functionTests/tests/lang/BooleanValuesTest.java
M      java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java


> Write a regression test to verify the behavior of ResultSet.getBoolean()
> ------------------------------------------------------------------------
>
>                 Key: DERBY-4663
>                 URL: https://issues.apache.org/jira/browse/DERBY-4663
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC, Test
>    Affects Versions: 10.7.0.0
>            Reporter: Rick Hillegas
>            Assignee: Rick Hillegas
>         Attachments: derby-4663-01-aa-regressionTest.diff
>
>
> The JDBC spec partially defines the expected behavior of ResultSet.getBoolean(). It would be good to have a regression test which tracks Derby's actual implementation. For the moment, it appears that Derby conforms to the defined behavior, does something reasonable in the undefined cases, and behaves the same way in the embedded and client drivers.
> The behavior of ResultSet.getBoolean() does not appear to have been defined until JDBC 4. Here is the JDBC 4 javadoc:
> "If the designated column has a datatype of CHAR or VARCHAR and contains a "0" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or BIGINT and contains a 0, a value of false is returned. If the designated column has a datatype of CHAR or VARCHAR and contains a "1" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or BIGINT and contains a 1, a value of true is returned." 
> The behavior for those datatypes is not specified if the actual value is not 0 or 1. However, in a private communication I have the following statement of intent from Lance Andersen, the JDBC spec lead:
> "Note: Please refer to your driver documentation for the return value when the designated column contains a values other than "0", 0, "1" or 1."
> In addition, the behavior for other datatypes is not specified. Some day it might be good if Derby's documentation described our behavior in the unspecified cases. Here it is:
> 1) ResultSet.getBoolean() on LONG VARCHAR behaves like CHAR and VARCHAR
> 2) ResultSet.getBoolean() on DECIMAL, REAL, DOUBLE, and NUMERIC behaves like INTEGER.
> 3) Derby raises an exception if you call ResultSet.getBoolean() on BLOB, CHAR FOR BIT DATA, CLOB, DATE, LONG VARCHAR FOR BIT DATA, TIME, TIMESTAMP, or VARCHAR FOR BIT DATA.
> 4) You can't even directly select an XML value.

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


[jira] Closed: (DERBY-4663) Write a regression test to verify the behavior of ResultSet.getBoolean()

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

Rick Hillegas closed DERBY-4663.
--------------------------------

    Resolution: Fixed

> Write a regression test to verify the behavior of ResultSet.getBoolean()
> ------------------------------------------------------------------------
>
>                 Key: DERBY-4663
>                 URL: https://issues.apache.org/jira/browse/DERBY-4663
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC, Test
>    Affects Versions: 10.7.0.0
>            Reporter: Rick Hillegas
>            Assignee: Rick Hillegas
>         Attachments: derby-4663-01-aa-regressionTest.diff
>
>
> The JDBC spec partially defines the expected behavior of ResultSet.getBoolean(). It would be good to have a regression test which tracks Derby's actual implementation. For the moment, it appears that Derby conforms to the defined behavior, does something reasonable in the undefined cases, and behaves the same way in the embedded and client drivers.
> The behavior of ResultSet.getBoolean() does not appear to have been defined until JDBC 4. Here is the JDBC 4 javadoc:
> "If the designated column has a datatype of CHAR or VARCHAR and contains a "0" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or BIGINT and contains a 0, a value of false is returned. If the designated column has a datatype of CHAR or VARCHAR and contains a "1" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or BIGINT and contains a 1, a value of true is returned." 
> The behavior for those datatypes is not specified if the actual value is not 0 or 1. However, in a private communication I have the following statement of intent from Lance Andersen, the JDBC spec lead:
> "Note: Please refer to your driver documentation for the return value when the designated column contains a values other than "0", 0, "1" or 1."
> In addition, the behavior for other datatypes is not specified. Some day it might be good if Derby's documentation described our behavior in the unspecified cases. Here it is:
> 1) ResultSet.getBoolean() on LONG VARCHAR behaves like CHAR and VARCHAR
> 2) ResultSet.getBoolean() on DECIMAL, REAL, DOUBLE, and NUMERIC behaves like INTEGER.
> 3) Derby raises an exception if you call ResultSet.getBoolean() on BLOB, CHAR FOR BIT DATA, CLOB, DATE, LONG VARCHAR FOR BIT DATA, TIME, TIMESTAMP, or VARCHAR FOR BIT DATA.
> 4) You can't even directly select an XML value.

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