mirror of https://github.com/apache/openjpa.git
OPENJPA-2355: Allow more than two input argument to CONCAT() - back ported to 2.1.x Pinaki Poddar's trunk changes.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/branches/2.1.x@1505837 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0e6a4b7252
commit
c47104b95f
|
@ -1295,11 +1295,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:
|
||||
if (node.children.length == 3) {
|
||||
|
|
|
@ -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() ] ")"
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -40,6 +40,9 @@ unknown-comp: Unknown comparison operator "{0}".
|
|||
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. \
|
||||
|
|
Loading…
Reference in New Issue