metamodel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kaspersorensen <...@git.apache.org>
Subject [GitHub] metamodel pull request: METAMODEL-224 CONCAT function support
Date Mon, 11 Jan 2016 12:08:26 GMT
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?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message