You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by rh...@apache.org on 2010/06/07 19:45:19 UTC
svn commit: r952348 - in /db/derby/code/trunk/java:
engine/org/apache/derby/impl/sql/compile/
testing/org/apache/derbyTesting/functionTests/master/
testing/org/apache/derbyTesting/functionTests/tests/lang/
Author: rhillegas
Date: Mon Jun 7 17:45:19 2010
New Revision: 952348
URL: http://svn.apache.org/viewvc?rev=952348&view=rev
Log:
DERBY-4583: Re-enable the TRUE and FALSE literals.
Modified:
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/db2Compatibility.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/implicitConversions.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/BooleanValuesTest.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/db2Compatibility.sql
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj?rev=952348&r1=952347&r2=952348&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj Mon Jun 7 17:45:19 2010
@@ -11592,7 +11592,6 @@ literal() throws StandardException :
|
tok = booleanLiteral()
{
- checkInternalFeature(tok.image);
return (ValueNode) nodeFactory.getNode(
C_NodeTypes.BOOLEAN_CONSTANT_NODE,
StringUtil.SQLEqualsIgnoreCase(tok.image, "true") ?
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/db2Compatibility.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/db2Compatibility.out?rev=952348&r1=952347&r2=952348&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/db2Compatibility.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/db2Compatibility.out Mon Jun 7 17:45:19 2010
@@ -1180,39 +1180,24 @@ ij> INSERT INTO t1 VALUES(3,4);
1 row inserted/updated/deleted
ij> INSERT INTO t2 VALUES(3,4);
1 row inserted/updated/deleted
-ij> -- (5) TRUE and FALSE constants should be disabled in WHERE clause of SELECT statement
+ij> -- (5) TRUE and FALSE constants are no longer disabled in WHERE clause of SELECT statement
SELECT * FROM t1 INNER JOIN t2 ON t1.col1 = t2.col1 WHERE true;
-ERROR 42X01: Syntax error: true.
-Issue the 'help' command for general information on IJ command syntax.
-Any unrecognized commands are treated as potential SQL commands and executed directly.
-Consult your DBMS server reference documentation for details of the SQL syntax supported by your server.
+COL1 |COL2 |COL1 |COL2
+-----------------------------------------------
+3 |4 |3 |4
ij> SELECT * FROM t1 INNER JOIN t2 ON t1.col1 = t2.col1 WHERE false;
-ERROR 42X01: Syntax error: false.
-Issue the 'help' command for general information on IJ command syntax.
-Any unrecognized commands are treated as potential SQL commands and executed directly.
-Consult your DBMS server reference documentation for details of the SQL syntax supported by your server.
-ij> -- (5) TRUE and FALSE constants should be disabled in WHERE clause of DELETE statement
+COL1 |COL2 |COL1 |COL2
+-----------------------------------------------
+ij> -- (5) TRUE and FALSE constants are no longer disabled in WHERE clause of DELETE statement
DELETE FROM t1 where true;
-ERROR 42X01: Syntax error: true.
-Issue the 'help' command for general information on IJ command syntax.
-Any unrecognized commands are treated as potential SQL commands and executed directly.
-Consult your DBMS server reference documentation for details of the SQL syntax supported by your server.
+1 row inserted/updated/deleted
ij> DELETE FROM t1 where false;
-ERROR 42X01: Syntax error: false.
-Issue the 'help' command for general information on IJ command syntax.
-Any unrecognized commands are treated as potential SQL commands and executed directly.
-Consult your DBMS server reference documentation for details of the SQL syntax supported by your server.
-ij> -- (5) TRUE and FALSE constants should be disabled in WHERE clause of DELETE statement
+0 rows inserted/updated/deleted
+ij> -- (5) TRUE and FALSE constants are no longer disabled in WHERE clause of DELETE statement
UPDATE t2 SET col1 = NULL WHERE true;
-ERROR 42X01: Syntax error: true.
-Issue the 'help' command for general information on IJ command syntax.
-Any unrecognized commands are treated as potential SQL commands and executed directly.
-Consult your DBMS server reference documentation for details of the SQL syntax supported by your server.
+1 row inserted/updated/deleted
ij> UPDATE t2 SET col1 = NULL WHERE false;
-ERROR 42X01: Syntax error: false.
-Issue the 'help' command for general information on IJ command syntax.
-Any unrecognized commands are treated as potential SQL commands and executed directly.
-Consult your DBMS server reference documentation for details of the SQL syntax supported by your server.
+0 rows inserted/updated/deleted
ij> -- (6) AT ISOLATION clause should be disabled in SELECT statement
-- AT ISOLATION not supported in both Cloudscape and DB2 mode and that is why rather than getting feature not implemented, we will get syntax error
SELECT * FROM t1 AT ISOLATION READ UNCOMMITTED;
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/implicitConversions.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/implicitConversions.out?rev=952348&r1=952347&r2=952348&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/implicitConversions.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/implicitConversions.out Mon Jun 7 17:45:19 2010
@@ -2613,15 +2613,9 @@ ERROR 42X61: Types 'DECIMAL' and 'CHAR'
ij> values 'a', 1.1;
ERROR 42X61: Types 'CHAR' and 'DECIMAL' are not UNION compatible.
ij> values true, 'a';
-ERROR 42X01: Syntax error: true.
-Issue the 'help' command for general information on IJ command syntax.
-Any unrecognized commands are treated as potential SQL commands and executed directly.
-Consult your DBMS server reference documentation for details of the SQL syntax supported by your server.
+ERROR 42X61: Types 'BOOLEAN' and 'CHAR' are not UNION compatible.
ij> values 'a', true;
-ERROR 42X01: Syntax error: true.
-Issue the 'help' command for general information on IJ command syntax.
-Any unrecognized commands are treated as potential SQL commands and executed directly.
-Consult your DBMS server reference documentation for details of the SQL syntax supported by your server.
+ERROR 42X61: Types 'CHAR' and 'BOOLEAN' are not UNION compatible.
ij> values date('1996-09-09'), 'a';
1
----------
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/BooleanValuesTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/BooleanValuesTest.java?rev=952348&r1=952347&r2=952348&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/BooleanValuesTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/BooleanValuesTest.java Mon Jun 7 17:45:19 2010
@@ -549,6 +549,37 @@ public class BooleanValuesTest extends
expectCompilationError( NOT_UNION_COMPATIBLE, query );
}
+ /**
+ * <p>
+ * Verify that boolean literals work.
+ * </p>
+ */
+ public void test_07_booleanLiterals() throws Exception
+ {
+ Connection conn = getConnection();
+
+ assertResults
+ (
+ conn,
+ "values ( true )",
+ new String[][]
+ {
+ { "true" },
+ },
+ false
+ );
+ assertResults
+ (
+ conn,
+ "values ( false )",
+ new String[][]
+ {
+ { "false" },
+ },
+ false
+ );
+ }
+
///////////////////////////////////////////////////////////////////////////////////
//
// SQL ROUTINES
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/db2Compatibility.sql
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/db2Compatibility.sql?rev=952348&r1=952347&r2=952348&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/db2Compatibility.sql (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/db2Compatibility.sql Mon Jun 7 17:45:19 2010
@@ -606,15 +606,15 @@ CREATE TABLE t2(col1 int, col2 int);
INSERT INTO t1 VALUES(3,4);
INSERT INTO t2 VALUES(3,4);
--- (5) TRUE and FALSE constants should be disabled in WHERE clause of SELECT statement
+-- (5) TRUE and FALSE constants are no longer disabled in WHERE clause of SELECT statement
SELECT * FROM t1 INNER JOIN t2 ON t1.col1 = t2.col1 WHERE true;
SELECT * FROM t1 INNER JOIN t2 ON t1.col1 = t2.col1 WHERE false;
--- (5) TRUE and FALSE constants should be disabled in WHERE clause of DELETE statement
+-- (5) TRUE and FALSE constants are no longer disabled in WHERE clause of DELETE statement
DELETE FROM t1 where true;
DELETE FROM t1 where false;
--- (5) TRUE and FALSE constants should be disabled in WHERE clause of DELETE statement
+-- (5) TRUE and FALSE constants are no longer disabled in WHERE clause of DELETE statement
UPDATE t2 SET col1 = NULL WHERE true;
UPDATE t2 SET col1 = NULL WHERE false;