Examples of SqlDescendingExpression


Examples of org.araneaframework.backend.list.sqlexpr.order.SqlDescendingExpression

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

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

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

Examples of org.araneaframework.backend.list.sqlexpr.order.SqlDescendingExpression

  class ReverseComparatorTranslator implements CompExprToSqlExprTranslator {
    public SqlExpression translate(ComparatorExpression expr, CompExprToSqlExprBuilder builder) {
      log.debug("Translating ReverseComparatorExpression");
      ReverseComparatorExpression parent = (ReverseComparatorExpression) expr;
      VariableComparatorExpression compExpr = (VariableComparatorExpression) parent.getChildren()[0];
      return new SqlDescendingExpression(translateVariableComparatorInternal(compExpr));
    }
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.