Package org.araneaframework.backend.list.sqlexpr.logical

Examples of org.araneaframework.backend.list.sqlexpr.logical.SqlAndExpression


 
  // logical
 
  class AndTranslator extends CompositeExprToSqlExprTranslator {
    protected SqlExpression translateParent(Expression expr, SqlExpression[] sqlChildren) {
      SqlExpression temp = new SqlAndExpression().setChildren(sqlChildren);
      return sqlChildren.length > 1 ? new SqlBracketsExpression(temp) : temp;
    }
View Full Code Here


  public void testSqlAndExpression() {
    log.debug("Testing SqlAndExpression");
    // constructing
    try {
      new SqlAndExpression();
    } catch (Exception e) {
      fail("Constructing of SqlAndExpression failed");
    }

    // SQL String
    assertEquals("SqlAndExpression must return an empty string",
        new SqlAndExpression().toSqlString(), "");
    assertEquals("SqlAndExpression must return \"a\"",
        new SqlAndExpression().add(new MockSqlStringExpression("a"))
            .toSqlString(), "a");
    assertEquals("SqlAndExpression must return \"a AND b\"",
        new SqlAndExpression().add(new MockSqlStringExpression("a"))
            .add(new MockSqlStringExpression("b")).toSqlString(),
        "a AND b");

    // SQL arguments
    assertTrue("SqlAndExpression must return an empty array", Arrays
        .equals(new SqlAndExpression().getValues(), new Object[0]));
    assertTrue("SqlAndExpression must return an empty array",
        Arrays
            .equals(
                new SqlAndExpression().add(
                    new MockSqlStringExpression(
                        new Object[0])).add(
                    new MockSqlStringExpression(
                        new Object[0])).getValues(),
                new Object[0]));
    assertTrue("SqlAndExpression must return (\"a\", \"b\") as values",
        Arrays.equals(new SqlAndExpression().add(
            new MockSqlStringExpression(new Object[] { "a" })).add(
            new MockSqlStringExpression(new Object[] { "b" }))
            .getValues(), new Object[] { "a", "b" }));
  }
View Full Code Here

TOP

Related Classes of org.araneaframework.backend.list.sqlexpr.logical.SqlAndExpression

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.