db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From banda...@apache.org
Subject svn commit: rev 56961 - in incubator/derby/code/trunk/java/engine/org/apache/derby: iapi/reference iapi/types impl/sql/compile loc
Date Mon, 08 Nov 2004 18:58:11 GMT
Author: bandaram
Date: Mon Nov  8 10:58:10 2004
New Revision: 56961

Modified:
   incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/reference/SQLState.java
   incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/Like.java
   incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
   incubator/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties
Log:
Derby-44: Enable LIKE ? ESCAPE ? syntax that was disabled before

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/reference/SQLState.java
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/reference/SQLState.java	(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/reference/SQLState.java	Mon
Nov  8 10:58:10 2004
@@ -658,7 +658,6 @@
 	String LANG_INVALID_ESCAPE_CHARACTER                               = "22019";
 	String LANG_INVALID_ESCAPE_SEQUENCE                                = "22025";
 	String LANG_INVALID_TRIM_SET                                       = "22027";
-	String LANG_LIKE_AND_ESCAPE_PARAM                                  = "22500";
 	String LANG_ESCAPE_IS_NULL                                  	   = "22501";
 	String LANG_NULL_INTO_NON_NULL                                     = "23502";
 	String LANG_DUPLICATE_KEY_CONSTRAINT                               = "23505";

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/Like.java
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/Like.java	(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/Like.java	Mon Nov 
8 10:58:10 2004
@@ -721,7 +721,7 @@
 		// what is there, while stripping escapes
 		//
 
-		if (escape != null)
+		if ((escape != null) && (escape.length() != 0))
 		{
 			char escChar = escape.charAt(0);
 			if (pattern.indexOf(escChar) != -1)
@@ -943,7 +943,7 @@
 			return null;
 		}
 
-		if (escape != null)
+		if ((escape != null) && (escape.length() !=0))
 		{
 			escChar = escape.charAt(0);
 		}

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
Mon Nov  8 10:58:10 2004
@@ -4710,19 +4710,6 @@
                 <LEFT_BRACE> <ESCAPE> escapeValue = additiveExpression(null,
0, inSelectClause) <RIGHT_BRACE>
             ]
 	{
-		//
-		// Error on the too hard to handle corner case of LIKE ? ESCAPE ?.
-		// The problem is at execution when we process the first ? we
-		// call Like.lssThanString/greaterThanString() with escape == null.
-		// There is no way to jam the escape parameter up for use in
-		// ExecAssociatedLikeParameter
-		//
-
-		if (escapeValue != null && escapeValue instanceof ParameterNode
-		    && likePattern instanceof ParameterNode)
-		{
-		    throw StandardException.newException(SQLState.LANG_LIKE_AND_ESCAPE_PARAM);
-		}
 		tree = (ValueNode) nodeFactory.getNode(
 								C_NodeTypes.LIKE_OPERATOR_NODE,
 								leftOperand,

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties	(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties	Mon
Nov  8 10:58:10 2004
@@ -370,7 +370,6 @@
 22019=Invalid escape sequence, ''{0}''. The escape string must be exactly one character.
It can not be a null or more than one character.
 22025=Escape character must be followed by escape character, '_', or '%'. It cannot be followed
by any other character or be at the end of the pattern.
 22027=The built-in TRIM() function only supports a single trim character.  The LTRIM() and
RTRIM() built-in functions support multiple trim characters.
-22500=Cannot use ? parameters for both the LIKE pattern and the ESCAPE clause.
 22501=An ESCAPE clause of NULL returns undefined results and is not allowed.
 23502=Column ''{0}''  cannot accept a NULL value.
 23505=The statement was aborted because it would have caused a duplicate key value in a unique
or primary key constraint or unique index identified by ''{0}'' defined on ''{1}''.

Mime
View raw message