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");


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");

Reply via email to