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 ba...@apache.org on 2004/11/12 03:14:55 UTC

svn commit: rev 57487 - incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile

Author: bandaram
Date: Thu Nov 11 18:14:55 2004
New Revision: 57487

Modified:
   incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/LikeEscapeOperatorNode.java
Log:
Derby-45: Allow expressions that result in string types as arguments to a LIKE expression

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/LikeEscapeOperatorNode.java
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/LikeEscapeOperatorNode.java	(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/LikeEscapeOperatorNode.java	Thu Nov 11 18:14:55 2004
@@ -153,7 +153,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");
 
@@ -165,7 +166,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");