Package net.sf.jsqlparser.expression.operators.arithmetic

Examples of net.sf.jsqlparser.expression.operators.arithmetic.Addition


        break label_22;
      }
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case 94:
        jj_consume_token(94);
                            result = new Addition();
        break;
      case 95:
        jj_consume_token(95);
                                                                        result = new Subtraction();
        break;
View Full Code Here


  @Test
  public void testParseExpression() throws Exception {
    Expression result = CCJSqlParserUtil.parseExpression("a+b");
    assertEquals("a + b", result.toString());
    assertTrue(result instanceof Addition);
    Addition add = (Addition)result;
    assertTrue(add.getLeftExpression() instanceof Column);
    assertTrue(add.getRightExpression() instanceof Column);
  }
View Full Code Here

    String sql = "select a,b,c from test";
    Select select = (Select) parserManager.parse(new StringReader(sql));
    ConnectExpressionsVisitor instance = new ConnectExpressionsVisitor("testexpr") {
      @Override
      protected BinaryExpression createBinaryExpression() {
        return new Addition();
      }
    };
    select.getSelectBody().accept(instance);

    assertEquals("SELECT a + b + c AS testexpr FROM test", select.toString());
View Full Code Here

  public void testAddExpr() throws JSQLParserException {
    Select select = (Select) CCJSqlParserUtil.parse("select a from mytable");
    SelectUtils.addExpression(select, new Column("b"));
    assertEquals("SELECT a, b FROM mytable", select.toString());
   
    Addition add = new Addition();
    add.setLeftExpression(new LongValue(5));
    add.setRightExpression(new LongValue(6));
    SelectUtils.addExpression(select, add);
   
    assertEquals("SELECT a, b, 5 + 6 FROM mytable", select.toString());
  }
View Full Code Here

                exp.getRightExpression());

        BinaryExpression qualified;

        if (exp instanceof Addition)
            qualified = new Addition();
        else if (exp instanceof Division)
            qualified = new Division();
        else if (exp instanceof Multiplication)
            qualified = new Multiplication();
        else if (exp instanceof Subtraction)
View Full Code Here

TOP

Related Classes of net.sf.jsqlparser.expression.operators.arithmetic.Addition

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.