Package com.googlecode.gql4j.GqlQuery

Examples of com.googlecode.gql4j.GqlQuery.StringEvaluator


  }
 
  @Test
  public void testValue_1() throws RecognitionException {   
    assertEquals(NullEvaluator.get(), parser("Null").value().r);
    assertEquals(new StringEvaluator("'abc'"), parser("'abc'").value().r);
    assertEquals(new BooleanEvaluator("true"), parser("true").value().r);
    assertEquals(new ParamEvaluator("abc"), parser(":abc").value().r);
    assertEquals(
        new FunctionEvaluator("key",
            ImmutableList.<Evaluator>of(new StringEvaluator("'abc'"))),
        parser("key('abc')").value().r);
   
    assertEquals(new DecimalEvaluator("1"), parser("1").value().r);
  }
View Full Code Here


  }
 
  @Test
  public void testCondition_2() throws RecognitionException {
    Condition expected = new Condition("d", FilterOperator.EQUAL,
        new FunctionEvaluator("datetime", new StringEvaluator("'2000-2-2 3:4:5'")));   

    Condition actual = parser("d = datetime('2000-2-2 3:4:5') ").condition().r;
   
    assertEquals(expected, actual);
  }
View Full Code Here

  @Test
  public void testParseWhere_2() {
    ParseResult actual = GqlQuery.parse("SELECT * from a where a = 1 and b <= '3'");
    ParseResult expected = new ParseResult().setSelect(new Select(false)).setFrom(new From("a")).setWhere(
        new Where().withCondition(new Condition("a", FilterOperator.EQUAL, new DecimalEvaluator("1")))
        .withCondition(new Condition("b", FilterOperator.LESS_THAN_OR_EQUAL, new StringEvaluator("'3'")))
        );
    assertEquals(expected, actual);
  }
View Full Code Here

  @Test
  public void testParseWhere_5() {
    ParseResult actual = GqlQuery.parse("SELECT * from a where a in (:abc, 'b', 'c')");
    ParseResult expected = new ParseResult().setSelect(new Select(false)).setFrom(new From("a")).setWhere(
        new Where().withCondition(new Condition("a", FilterOperator.IN,
            new ListEvaluator(new ParamEvaluator("abc"), new StringEvaluator("'b'"), new StringEvaluator("'c'")))));
    assertEquals(expected, actual);
  }
View Full Code Here

  @Test
  public void testParseWhere_6() {
    ParseResult actual = GqlQuery.parse("SELECT * from a WHERE ANCESTOR IS KEY('Person', 'Amy')");
    ParseResult expected = new ParseResult().setSelect(new Select(false)).setFrom(new From("a")).setWhere(
        new Where().withAncestor(
            new FunctionEvaluator("key", new StringEvaluator("'Person'"), new StringEvaluator("'Amy'"))));
    assertEquals(expected, actual);
  }
View Full Code Here

TOP

Related Classes of com.googlecode.gql4j.GqlQuery.StringEvaluator

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.