Package org.araneaframework.backend.list.sqlexpr.constant

Examples of org.araneaframework.backend.list.sqlexpr.constant.SqlValueExpression


    }
    catch (Exception e) {
      fail("Building SqlExpression failed");
    }
   
    SqlValueExpression sql = null;
    try {
      sql = (SqlValueExpression) tmp;
    }
    catch (Exception e) {
      fail("Casting into SqlValueExpression failed");
View Full Code Here


 
  // constant
 
  class ValueTranslator implements ExprToSqlExprTranslator {
    public SqlExpression translate(Expression expr, ExpressionToSqlExprBuilder builder) {
      return new SqlValueExpression(convertValue((Value) expr));
    }
View Full Code Here

 
  class LikeTranslator extends CompositeExprToSqlExprTranslator {
    protected SqlExpression translateParent(Expression expr, SqlExpression[] sqlChildren) {
      LikeExpression like = (LikeExpression) expr;     
      SqlExpression var = sqlChildren[0];
      SqlExpression mask = new SqlValueExpression(
          "%" + convertValue(like.getMask()) + "%");
      if (like.getIgnoreCase()) {
        var = new SqlUpperExpression(var);
        mask = new SqlUpperExpression(mask);
      }
View Full Code Here

  public void testSqlValueExpression() {
    log.debug("Testing SqlValueExpression");
    // constructing
    try {
      new SqlValueExpression(null);
    } catch (Exception e) {
      fail("Constructing of SqlValueExpression failed with null-value");
    }
    try {
      new SqlValueExpression("a");
    } catch (Exception e) {
      fail("Constructing of SqlValueExpression failed with not-null value");
    }

    // SQL String
    assertEquals("SqlValueExpression must return ?",
        new SqlValueExpression(null).toSqlString(), "?");
    assertEquals("SqlValueExpression must return ?",
        new SqlValueExpression("a").toSqlString(), "?");

    // SQL arguments
    assertTrue("SqlValueExpression must return (null) as values", Arrays
        .equals(new SqlValueExpression(null).getValues(),
            new Object[] { null }));
    assertTrue("SqlValueExpression must return (\"a\") as values", Arrays
        .equals(new SqlValueExpression("a").getValues(),
            new Object[] { "a" }));
  }
View Full Code Here

TOP

Related Classes of org.araneaframework.backend.list.sqlexpr.constant.SqlValueExpression

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.