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/06/16 20:04:26 UTC
[jira] Updated: (DERBY-4658) Allow explicit casts of string values
to BOOLEAN
[ https://issues.apache.org/jira/browse/DERBY-4658?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Rick Hillegas updated DERBY-4658:
---------------------------------
Attachment: derby-4658-01-aa-booleanCasts.diff
Attaching derby-4658-01-aa-booleanCasts.diff. This patch makes it possible to cast values to BOOLEAN. I need to run regression tests.
Makes the following changes:
1) Makes parser accept CAST (... AS BOOLEAN)
2) Allows those casts to succeed provided that the source datatype is a string and the actual value satisfies the SQL Standard's rules.
3) Adds regression tests for this feature.
Touches the following files:
--------------
M java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
Parser now accepts explicit casts to BOOLEAN.
--------------
M java/engine/org/apache/derby/impl/sql/compile/CastNode.java
M java/engine/org/apache/derby/impl/sql/compile/BooleanConstantNode.java
M java/engine/org/apache/derby/iapi/types/SQLBoolean.java
Standard support for the string value "UNKNOWN".
--------------
M java/testing/org/apache/derbyTesting/functionTests/tests/lang/BooleanValuesTest.java
Regression tests.
> Allow explicit casts of string values to BOOLEAN
> ------------------------------------------------
>
> Key: DERBY-4658
> URL: https://issues.apache.org/jira/browse/DERBY-4658
> Project: Derby
> Issue Type: Improvement
> Components: SQL
> Reporter: Rick Hillegas
> Assignee: Rick Hillegas
> Attachments: derby-4658-01-aa-booleanCasts.diff
>
>
> The SQL Standard allows strings to be explicitly cast to BOOLEAN values. Strings are the only type (other than BOOLEAN itself) which can be cast to BOOLEAN. As part of our expanding support for the BOOLEAN datatype, we should allow these casts.
> Casting string types to boolean is defined by part 2, section 6.12 (<cast specification>), general rule 20:
> a) Trim whitespace off the string
> b) Then apply the rules in section 5.3 (<literal>). This means that the trimmed string must be 'TRUE', 'FALSE', or 'UNKNOWN', regardless of case.
> c) Otherwise, raise an exception.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.