Examples of SqlLikeExpression


Examples of org.araneaframework.backend.list.sqlexpr.compare.SqlLikeExpression

          "%" + convertValue(like.getMask()) + "%");
      if (like.getIgnoreCase()) {
        var = new SqlUpperExpression(var);
        mask = new SqlUpperExpression(mask);
      }
      return new SqlLikeExpression(var, mask);
    }
View Full Code Here

Examples of org.araneaframework.backend.list.sqlexpr.compare.SqlLikeExpression

  public void testSqlLikeExpression() {
    log.debug("Testing SqlLikeExpression");
    // constructing
    try {
      new SqlLikeExpression(null, null);
      fail("Constructing of SqlLikeExpression with NULL as SqlExpression arguments should fail");
    } catch (Exception e) {
      // normal
    }
    try {
      new SqlLikeExpression(null, new MockSqlStringExpression("a"));
      fail("Constructing of SqlLikeExpression with NULL as first SqlExpression argument should fail");
    } catch (Exception e) {
      // normal
    }
    try {
      new SqlLikeExpression(new MockSqlStringExpression("a"), null);
      fail("Constructing of SqlLikeExpression with NULL as second SqlExpression argument should fail");
    } catch (Exception e) {
      // normal
    }

    // SQL String
    assertEquals("SqlLikeExpression must return \" LIKE \"",
        new SqlLikeExpression(new MockSqlStringExpression(""),
            new MockSqlStringExpression("")).toSqlString(),
        " LIKE ");
    assertEquals("SqlLikeExpression must return \"a LIKE b\"",
        new SqlLikeExpression(new MockSqlStringExpression("a"),
            new MockSqlStringExpression("b")).toSqlString(),
        "a LIKE b");

    // SQL arguments
    assertTrue("SqlLikeExpression must return an empty array", Arrays
        .equals(new SqlLikeExpression(new MockSqlStringExpression(""),
            new MockSqlStringExpression("")).getValues(),
            new Object[0]));
    assertTrue("SqlLikeExpression must return an empty array", Arrays
        .equals(new SqlLikeExpression(new MockSqlStringExpression(
            new Object[] { "a" }), new MockSqlStringExpression(
            new Object[] { "b" })).getValues(), new Object[] { "a",
            "b" }));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.