Examples of LikeExpression


Examples of org.codehaus.jparsec.examples.sql.ast.LikeExpression

  }

  @Test
  public void testLike() {
    Parser<Expression> parser = ExpressionParser.like(NUMBER);
    assertParser(parser, "1 like 2", new LikeExpression(number(1), true, number(2), null));
    assertParser(parser, "1 not like 2", new LikeExpression(number(1), false, number(2), null));
    assertParser(parser, "1 like 2 escape 3",
        new LikeExpression(number(1), true, number(2), number(3)));
    assertParser(parser, "1 not like 2 escape 3",
        new LikeExpression(number(1), false, number(2), number(3)));
  }
View Full Code Here

Examples of org.codehaus.jparsec.examples.sql.ast.LikeExpression

    assertParser(parser, "1 = 2", new BinaryExpression(number(1), Op.EQ, number(2)));
    assertParser(parser, "1 is null",
        new BinaryExpression(number(1), Op.IS, NullExpression.instance));
    assertParser(parser, "1 is not null",
        new BinaryExpression(number(1), Op.NOT, NullExpression.instance));
    assertParser(parser, "1 like 2", new LikeExpression(number(1), true, number(2), null));
    assertParser(parser, "(1 < 2 or not exists t)",
        new BinaryExpression(
            new BinaryExpression(number(1), Op.LT, number(2)),
            Op.OR,
            new UnaryExpression(Op.NOT,
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.parser.LikeExpression

    if (stateObject.isDecorated()) {
      toText(stateObject);
    }
    else {
      LikeExpression expression = stateObject.getExpression();

      // String expression
      if (stateObject.hasStringStateObject()) {
        stateObject.getStringStateObject().accept(this);
      }

      if (shouldOutput(expression) || expression.hasSpaceAfterStringExpression()) {
        writer.append(SPACE);
      }

      // 'NOT'
      if (stateObject.hasNot()) {
        appendIdentifier((expression != null) ? expression.getActualNotIdentifier() : NOT, NOT);
        writer.append(SPACE);
      }

      // 'LIKE'
      appendIdentifier((expression != null) ? expression.getActualLikeIdentifier() : LIKE, LIKE);

      if (shouldOutput(expression) || expression.hasSpaceAfterLike()) {
        writer.append(SPACE);
      }

      // Pattern value
      if (stateObject.hasPatternValue()) {
        stateObject.getPatternValue().accept(this);
      }

      if (exactMatch && (expression != null) && expression.hasSpaceAfterPatternValue()) {
        writer.append(SPACE);
      }

      // Escape character
      if (stateObject.hasEscapeCharacter()) {

        if (!exactMatch) {
          writer.append(SPACE);
        }

        appendIdentifier((expression != null) ? expression.getActualEscapeIdentifier() : ESCAPE, ESCAPE);

        if (shouldOutput(expression) || expression.hasSpaceAfterEscape()) {
          writer.append(SPACE);
        }

        writer.append(stateObject.getEscapeCharacter());
      }
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.parser.LikeExpression

    if (stateObject.isDecorated()) {
      toText(stateObject);
    }
    else {
      LikeExpression expression = stateObject.getExpression();

      // String expression
      if (stateObject.hasStringStateObject()) {
        stateObject.getStringStateObject().accept(this);
      }

      if (shouldOutput(expression) || expression.hasSpaceAfterStringExpression()) {
        writer.append(SPACE);
      }

      // 'NOT'
      if (stateObject.hasNot()) {
        appendIdentifier((expression != null) ? expression.getActualNotIdentifier() : NOT, NOT);
        writer.append(SPACE);
      }

      // 'LIKE'
      appendIdentifier((expression != null) ? expression.getActualLikeIdentifier() : LIKE, LIKE);

      if (shouldOutput(expression) || expression.hasSpaceAfterLike()) {
        writer.append(SPACE);
      }

      // Pattern value
      if (stateObject.hasPatternValue()) {
        stateObject.getPatternValue().accept(this);
      }

      if (exactMatch && (expression != null) && expression.hasSpaceAfterPatternValue()) {
        writer.append(SPACE);
      }

      // Escape character
      if (stateObject.hasEscapeCharacter()) {

        if (!exactMatch) {
          writer.append(SPACE);
        }

        appendIdentifier((expression != null) ? expression.getActualEscapeIdentifier() : ESCAPE, ESCAPE);

        if (shouldOutput(expression) || expression.hasSpaceAfterEscape()) {
          writer.append(SPACE);
        }

        writer.append(stateObject.getEscapeCharacter());
      }
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.parser.LikeExpression

    if (stateObject.isDecorated()) {
      toText(stateObject);
    }
    else {
      LikeExpression expression = stateObject.getExpression();

      // String expression
      if (stateObject.hasStringStateObject()) {
        stateObject.getStringStateObject().accept(this);
      }

      if (shouldOutput(expression) || expression.hasSpaceAfterStringExpression()) {
        writer.append(SPACE);
      }

      // 'NOT'
      if (stateObject.hasNot()) {
        appendIdentifier((expression != null) ? expression.getActualNotIdentifier() : NOT, NOT);
        writer.append(SPACE);
      }

      // 'LIKE'
      appendIdentifier((expression != null) ? expression.getActualLikeIdentifier() : LIKE, LIKE);

      if (shouldOutput(expression) || expression.hasSpaceAfterLike()) {
        writer.append(SPACE);
      }

      // Pattern value
      if (stateObject.hasPatternValue()) {
        stateObject.getPatternValue().accept(this);
      }

      if (exactMatch && (expression != null) && expression.hasSpaceAfterPatternValue()) {
        writer.append(SPACE);
      }

      // Escape character
      if (stateObject.hasEscapeCharacter()) {

        if (!exactMatch) {
          writer.append(SPACE);
        }

        appendIdentifier((expression != null) ? expression.getActualEscapeIdentifier() : ESCAPE, ESCAPE);

        if (shouldOutput(expression) || expression.hasSpaceAfterEscape()) {
          writer.append(SPACE);
        }

        writer.append(stateObject.getEscapeCharacter());
      }
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.parser.LikeExpression

    if (stateObject.isDecorated()) {
      toText(stateObject);
    }
    else {
      LikeExpression expression = stateObject.getExpression();

      // String expression
      if (stateObject.hasStringStateObject()) {
        stateObject.getStringStateObject().accept(this);
      }

      if (shouldOutput(expression) || expression.hasSpaceAfterStringExpression()) {
        writer.append(SPACE);
      }

      // 'NOT'
      if (stateObject.hasNot()) {
        appendIdentifier((expression != null) ? expression.getActualNotIdentifier() : NOT, NOT);
        writer.append(SPACE);
      }

      // 'LIKE'
      appendIdentifier((expression != null) ? expression.getActualLikeIdentifier() : LIKE, LIKE);

      if (shouldOutput(expression) || expression.hasSpaceAfterLike()) {
        writer.append(SPACE);
      }

      // Pattern value
      if (stateObject.hasPatternValue()) {
        stateObject.getPatternValue().accept(this);
      }

      if (exactMatch && (expression != null) && expression.hasSpaceAfterPatternValue()) {
        writer.append(SPACE);
      }

      // Escape character
      if (stateObject.hasEscapeCharacter()) {

        if (!exactMatch) {
          writer.append(SPACE);
        }

        appendIdentifier((expression != null) ? expression.getActualEscapeIdentifier() : ESCAPE, ESCAPE);

        if (shouldOutput(expression) || expression.hasSpaceAfterEscape()) {
          writer.append(SPACE);
        }

        writer.append(stateObject.getEscapeCharacter());
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.