openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hthom...@apache.org
Subject svn commit: r1505839 - in /openjpa/branches/2.2.1.x: ./ openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/ openjpa-kernel/src/main/jjtree/org/apache/openjpa/kernel/jpql/ openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/jpql/ openjp...
Date Mon, 22 Jul 2013 22:35:00 GMT
Author: hthomann
Date: Mon Jul 22 22:35:00 2013
New Revision: 1505839

URL: http://svn.apache.org/r1505839
Log:
OPENJPA-2355: Allow more than two input argument to CONCAT() - back ported to 2.2.1.x Pinaki
Poddar's trunk changes.

Modified:
    openjpa/branches/2.2.1.x/   (props changed)
    openjpa/branches/2.2.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java
    openjpa/branches/2.2.1.x/openjpa-kernel/src/main/jjtree/org/apache/openjpa/kernel/jpql/JPQL.jjt
    openjpa/branches/2.2.1.x/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/jpql/localizer.properties
    openjpa/branches/2.2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/jointable/onetomany/
  (props changed)

Propchange: openjpa/branches/2.2.1.x/
------------------------------------------------------------------------------
  Merged /openjpa/branches/2.1.x:r1505837
  Merged /openjpa/trunk:r1459091,1504282

Modified: openjpa/branches/2.2.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java?rev=1505839&r1=1505838&r2=1505839&view=diff
==============================================================================
--- openjpa/branches/2.2.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java
(original)
+++ openjpa/branches/2.2.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java
Mon Jul 22 22:35:00 2013
@@ -1297,11 +1297,22 @@ public class JPQLExpressionBuilder
                 return factory.trim(val1, trimChar, trimWhere);
 
             case JJTCONCAT:
-                val1 = getValue(left(node));
-                val2 = getValue(right(node));
+                if (node.children.length < 2)
+                	throw parseException(EX_USER, "less-child-count",
+                        new Object[]{ Integer.valueOf(2), node,
+                            Arrays.asList(node.children) }, null);
+
+                val1 = getValue(firstChild(node));
+                val2 = getValue(secondChild(node));
                 setImplicitType(val1, TYPE_STRING);
                 setImplicitType(val2, TYPE_STRING);
-                return factory.concat(val1, val2);
+                Value concat = factory.concat(val1, val2);
+                for (int i = 2; i < node.children.length; i++) {
+                	val2 = getValue(node.children[i]);
+                    setImplicitType(val2, TYPE_STRING);
+                	concat = factory.concat(concat, val2);
+                }
+                return concat;
 
             case JJTSUBSTRING:
                 // Literals are forced to be Integers because PostgreSQL rejects Longs in
SUBSTRING parameters.

Modified: openjpa/branches/2.2.1.x/openjpa-kernel/src/main/jjtree/org/apache/openjpa/kernel/jpql/JPQL.jjt
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.1.x/openjpa-kernel/src/main/jjtree/org/apache/openjpa/kernel/jpql/JPQL.jjt?rev=1505839&r1=1505838&r2=1505839&view=diff
==============================================================================
--- openjpa/branches/2.2.1.x/openjpa-kernel/src/main/jjtree/org/apache/openjpa/kernel/jpql/JPQL.jjt
(original)
+++ openjpa/branches/2.2.1.x/openjpa-kernel/src/main/jjtree/org/apache/openjpa/kernel/jpql/JPQL.jjt
Mon Jul 22 22:35:00 2013
@@ -1195,7 +1195,7 @@ void functions_returning_strings() : { }
 
 void concat() #CONCAT : { }
 {
-	<CONCAT> "(" string_expression() <COMMA> string_expression() ")"
+	<CONCAT> "(" string_expression() <COMMA> string_expression() [ <COMMA>
string_expression() ] ")"
 }
 
 

Modified: openjpa/branches/2.2.1.x/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/jpql/localizer.properties
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.1.x/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/jpql/localizer.properties?rev=1505839&r1=1505838&r2=1505839&view=diff
==============================================================================
--- openjpa/branches/2.2.1.x/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/jpql/localizer.properties
(original)
+++ openjpa/branches/2.2.1.x/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/jpql/localizer.properties
Mon Jul 22 22:35:00 2013
@@ -40,6 +40,9 @@ unknown-comp: Unknown comparison operato
 wrong-child-count: Wrong number of arguments to expression \
 	of type "{1}": should have been {0}, but the following arguments \
 	were specified: "{2}".
+less-child-count:There are an insufficient number of arguments for the expression \
+        of type "{1}".  The expression requires at least {0} arguments, and the \
+        following arguments were provided: "{2}"
 not-schema-name: The name "{0}" is not a recognized entity or identifier. \
     Known entity names: {1}
 not-schema-name-hint: The name "{0}" is not a recognized entity or identifier. \

Propchange: openjpa/branches/2.2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/jointable/onetomany/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Jul 22 22:35:00 2013
@@ -0,0 +1 @@
+/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/jointable/onetomany:1459091,1504282



Mime
View raw message