Package org.araneaframework.backend.list.sqlexpr.string

Examples of org.araneaframework.backend.list.sqlexpr.string.SqlUpperExpression


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

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

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


      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);
      }
      return new SqlLikeExpression(var, mask);
    }
View Full Code Here

    CompositeExprToSqlExprTranslator {
 
  protected final SqlExpression translateParent(Expression expr, SqlExpression[] sqlChildren) {
    if (((StringExpression) expr).getIgnoreCase()) {
      return translateComparable(expr,
          new SqlUpperExpression(sqlChildren[0]),
          new SqlUpperExpression(sqlChildren[1]));
    }
    return translateComparable(expr, sqlChildren[0], sqlChildren[1]);

  }
View Full Code Here

      comparator = ((NullComparator) comparator).getNotNullComparator();
    }
    log.debug("Comparator: " + comparator);
    if (StringComparator.class.isAssignableFrom(comparator.getClass())) {
      if (((StringComparator) comparator).getIgnoreCase()) {
        temp = new SqlUpperExpression(temp);
      }
    }
    return temp;
  }
View Full Code Here

TOP

Related Classes of org.araneaframework.backend.list.sqlexpr.string.SqlUpperExpression

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.