[
https://issues.apache.org/jira/browse/METAMODEL-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15091822#comment-15091822
]
ASF GitHub Bot commented on METAMODEL-224:
------------------------------------------
Github user kaspersorensen commented on a diff in the pull request:
https://github.com/apache/metamodel/pull/85#discussion_r49314335
--- Diff: core/src/main/java/org/apache/metamodel/query/SelectItem.java ---
@@ -484,11 +498,24 @@ public StringBuilder toStringNoAlias(boolean
includeSchemaInColumnPath) {
final Object[] functionParameters = getFunctionParameters();
if (functionParameters != null && functionParameters.length !=
0) {
for (int i = 0; i < functionParameters.length; i++) {
- functionBeginning.append('\'');
- functionBeginning.append(functionParameters[i]);
- functionBeginning.append('\'');
+ if (functionParameters[i] instanceof Column) {
+ Column col = (Column) functionParameters[i];
+
functionBeginning.append(getToStringColumnPrefix(includeSchemaInColumnPath,
col));
+ functionBeginning.append(col.getQuotedName());
+ } else {
+ if
(!_function.getFunctionName().equals(FunctionType.CONCAT.getFunctionName())) {
+ functionBeginning.append('\'');
+ }
+ functionBeginning.append(functionParameters[i]);
+ if
(!_function.getFunctionName().equals(FunctionType.CONCAT.getFunctionName())) {
+ functionBeginning.append('\'');
+ }
--- End diff --
Actually, looking at it again, how about just doing an ```if
(functionParameters[i] instanceof String)``` and then only adding the quotes
before and after in that case? For numbers, columns, selectitems etc. we
wouldn't want any quote I think. And that does not seem to be specific to the
CONCAT function at all?
> Support CONCAT function
> -----------------------
>
> Key: METAMODEL-224
> URL: https://issues.apache.org/jira/browse/METAMODEL-224
> Project: Apache MetaModel
> Issue Type: New Feature
> Reporter: Alberto
> Priority: Minor
>
> As we now support scalar functions it would be great to add support for a
> CONCAT function that allow us to concatenate and append strings to the query
> results.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)