db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From myrnap <my...@Golux.Com>
Subject [PATCH] JIRA 45 - support for cast(string) in like clause
Date Thu, 11 Nov 2004 19:13:14 GMT
replaced isConstantCharNode() with getTypeId().isStringTypeId(). The 
standards imply that anything that resolves to a string should be 
acceptable.

Index: 
java/engine/org/apache/derby/impl/sql/compile/LikeEscapeOperatorNode.java
===================================================================
--- 
java/engine/org/apache/derby/impl/sql/compile/LikeEscapeOperatorNode.java    
(revision 57450)
+++ 
java/engine/org/apache/derby/impl/sql/compile/LikeEscapeOperatorNode.java    
(working copy)
@@ -157,7 +157,8 @@
             throw 
StandardException.newException(SQLState.LANG_DB2_LIKE_SYNTAX_ERROR);
 
         // pattern must be a string or a parameter
-        if (!(leftOperand instanceof CharConstantNode) && 
!(leftOperand.isParameterNode()))
+
+        if (!(leftOperand.isParameterNode()) && 
!(leftOperand.getTypeId().isStringTypeId()))
             throw 
StandardException.newException(SQLState.LANG_DB2_FUNCTION_INCOMPATIBLE,
                                                      "LIKE", "FUNCTION");
 
@@ -169,7 +170,9 @@
         }
 
         // escape must be a string or a parameter
-        if (rightOperand != null && !(rightOperand instanceof 
CharConstantNode) && !(rightOperand.isParameterNode()))
+        if ((rightOperand != null) &&
+            !(rightOperand.isParameterNode()) &&
+            !(rightOperand.getTypeId().isStringTypeId()))
         {
             throw 
StandardException.newException(SQLState.LANG_DB2_FUNCTION_INCOMPATIBLE,
                                          "LIKE", "FUNCTION");


Mime
View raw message