Package net.sf.jsqlparser.expression

Examples of net.sf.jsqlparser.expression.Function


      result.add(be.getRightExpression());
    } else if (expr instanceof Parenthesis) {
      final Parenthesis prnths = (Parenthesis) expr;
      result.add(prnths.getExpression());
    } else if (expr instanceof Function) {
      final Function fun = (Function) expr;
      final ExpressionList params = fun.getParameters();
      if (params != null)
        result.addAll(params.getExpressions());
    } else
      return null;
    return result;
View Full Code Here


      if (si instanceof SelectExpressionItem) {
        final Expression selectExpr = ((SelectExpressionItem) si).getExpression();
        if (!(selectExpr instanceof Function))
          _exprList.add(selectExpr);
        else {
          final Function fun = (Function) selectExpr;
          if (fun.getName().equalsIgnoreCase("SUM"))
            // collect internal expressions
            collectInternalExprs(fun);
          else if (fun.getName().equalsIgnoreCase("COUNT")) {
            if (fun.isDistinct())
              // It's of interest only if isDistinct is set to
              // true
              // otherwise, it's the same as COUNT(*)
              collectInternalExprs(fun);
          } else
View Full Code Here

  /*
   * Have to distinguish special cases from normal ones
   */
  private TypeConversion getTC(Expression expr) {
    if (expr instanceof Function) {
      final Function fun = (Function) expr;
      if (fun.getName().equalsIgnoreCase("EXTRACT_YEAR"))
        return _ic;
    }

    // non special cases
    final List<Column> columns = ParserUtil.getJSQLColumns(expr);
View Full Code Here

      {if (true) return selectItemsList;}
    throw new Error("Missing return statement in function");
  }

  final public SelectItem SelectItem() throws ParseException {
        Function function = null;
        AllColumns allTableColumns = null;
        Column tableColumn = null;
        String alias = null;
        SelectItem selectItem = null;
        SelectExpressionItem selectExpressionItem = null;
View Full Code Here

           {if (true) return whenThen;}
    throw new Error("Missing return statement in function");
  }

  final public Function Function() throws ParseException {
        Function retval = new Function();
        String funcName = null;
        String tmp = null;
        ExpressionList expressionList = null;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case 102:
      jj_consume_token(102);
                 retval.setEscaped(true);
      break;
    default:
      jj_la1[127] = jj_gen;
      ;
    }
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case S_IDENTIFIER:
    case S_QUOTED_IDENTIFIER:
      funcName = RelObjectName();
      break;
    case K_REPLACE:
      jj_consume_token(K_REPLACE);
                          funcName = "REPLACE";
      break;
    default:
      jj_la1[128] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case 81:
      jj_consume_token(81);
      tmp = RelObjectName();
                                  funcName+= "." + tmp;
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case 81:
        jj_consume_token(81);
        tmp = RelObjectName();
                                                                                     funcName+= "." + tmp;
        break;
      default:
        jj_la1[129] = jj_gen;
        ;
      }
      break;
    default:
      jj_la1[130] = jj_gen;
      ;
    }
    jj_consume_token(79);
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case K_ALL:
    case K_NULL:
    case K_CASE:
    case K_REPLACE:
    case K_DISTINCT:
    case S_DOUBLE:
    case S_INTEGER:
    case S_IDENTIFIER:
    case S_CHAR_LITERAL:
    case S_QUOTED_IDENTIFIER:
    case 79:
    case 82:
    case 83:
    case 94:
    case 95:
    case 98:
    case 100:
    case 101:
    case 102:
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case K_ALL:
      case K_DISTINCT:
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case K_DISTINCT:
          jj_consume_token(K_DISTINCT);
                          retval.setDistinct(true);
          break;
        case K_ALL:
          jj_consume_token(K_ALL);
                                                                  retval.setAllColumns(true);
          break;
        default:
          jj_la1[131] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
        break;
      default:
        jj_la1[132] = jj_gen;
        ;
      }
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case K_NULL:
      case K_CASE:
      case K_REPLACE:
      case S_DOUBLE:
      case S_INTEGER:
      case S_IDENTIFIER:
      case S_CHAR_LITERAL:
      case S_QUOTED_IDENTIFIER:
      case 79:
      case 83:
      case 94:
      case 95:
      case 98:
      case 100:
      case 101:
      case 102:
        expressionList = SimpleExpressionList();
        break;
      case 82:
        jj_consume_token(82);
                                                                                                                                                retval.setAllColumns(true);
        break;
      default:
        jj_la1[133] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      break;
    default:
      jj_la1[134] = jj_gen;
      ;
    }
    jj_consume_token(80);
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case 99:
      jj_consume_token(99);
      break;
    default:
      jj_la1[135] = jj_gen;
      ;
    }
            retval.setParameters(expressionList);
            retval.setName(funcName);
        {if (true) return retval;}
    throw new Error("Missing return statement in function");
  }
View Full Code Here

    public void visit(NullValue nullValue) {
        _qualifiedExpression = nullValue;
    }

    public void visit(Function function) {
        Function qfunction = new Function();
        qfunction.setAllColumns(function.isAllColumns());
        qfunction.setEscaped(function.isEscaped());
        qfunction.setName(function.getName());

        ExpressionList parameters = function.getParameters();
        ExpressionList qualifiedParams;

        qualifiedParams = (ExpressionList) ItemsListQualifier.qualify(session, tableAliases,
                parameters);

        qfunction.setParameters(qualifiedParams);

        this._qualifiedExpression = qfunction;
    }
View Full Code Here

TOP

Related Classes of net.sf.jsqlparser.expression.Function

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.