db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brett Wooldridge (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-5042) ResultSet.updateBoolean() on new BOOLEAN type throws exception
Date Tue, 15 Feb 2011 08:59:57 GMT

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

Brett Wooldridge commented on DERBY-5042:

It shouldn't be a problem if boolean can be cast.  In that case, in a future upgrade (of our
software), we could create a new column of type boolean and populate it by casting the smallint
(which I'm now using) to it.  Then dropping the original smallint column.  Is cast supported?

> ResultSet.updateBoolean() on new BOOLEAN type throws exception
> --------------------------------------------------------------
>                 Key: DERBY-5042
>                 URL: https://issues.apache.org/jira/browse/DERBY-5042
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Client
>    Affects Versions:
>         Environment: OS X 10.6.5, Java 1.6
>            Reporter: Brett Wooldridge
>            Assignee: C.S. Nirmal J. Fernando
> I am encountering an error trying to update a BOOLEAN type through an
> updatable ResultSet.  My table looks like this:
> CREATE TABLE file_store (
>   path VARCHAR(255) NOT NULL,
>   network VARCHAR(32) NOT NULL,
>   file_blob BLOB,
>   file_md5 VARCHAR(32),
>   is_directory BOOLEAN NOT NULL DEFAULT false,
>   PRIMARY KEY (path, network)
> );
> My SQL looks like this:
> SELECT path, network, is_directory FROM file_store
> WHERE path=? AND network=? AND is_directory=true FOR UPDATE OF path, network, is_directory
> My Java code looks like this:
> ...
> resultSet.moveToInsertRow();
> resultSet.updateString("path", dirPath);
> resultSet.updateString("network", network);
> resultSet.updateBoolean("is_directory", true);
> resultSet.insertRow();
> An exception is thrown in the call to updateBoolean() as follows:
> java.sql.SQLException: An attempt was made to put a data value of type 'byte' into a
data value of type 'BOOLEAN'.
> It's a shame, I was looking forward to using the new BOOLEAN type before I roll out the
next version of our software.  For now I will fallback to SMALLINT.  Does/will ALTER TABLE
support a change from SMALLINT to BOOLEAN?

This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


View raw message