Package org.araneaframework.backend.list.sqlexpr

Examples of org.araneaframework.backend.list.sqlexpr.SqlBracketsExpression


  public void testSqlParanthesesExpression() {
    log.debug("Testing SqlParanthesesExpression");
    // constructing
    try {
      new SqlBracketsExpression(null);
      fail("Constructing of SqlParanthesesExpression with NULL as SqlExpression argument should fail");
    } catch (Exception e) {
      // normal
    }

    // SQL String
    assertEquals("SqlParanthesesExpression must return \"()\"",
        new SqlBracketsExpression(new MockSqlStringExpression(""))
            .toSqlString(), "()");
    assertEquals("SqlParanthesesExpression must return \"(a)\"",
        new SqlBracketsExpression(new MockSqlStringExpression("a"))
            .toSqlString(), "(a)");

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


  // 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

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

TOP

Related Classes of org.araneaframework.backend.list.sqlexpr.SqlBracketsExpression

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.