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

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


    }
  }
 
  class ConcatenationTranslator extends CompositeExprToSqlExprTranslator {
    protected SqlExpression translateParent(Expression expr, SqlExpression[] sqlChildren) {
      return new SqlConcatenationExpression().setChildren(sqlChildren);
    }
View Full Code Here


  public void testSqlConcatenationExpression() {
    log.debug("Testing SqlConcatenationExpression");
    // constructing
    try {
      new SqlConcatenationExpression();
    } catch (Exception e) {
      fail("Constructing of SqlConcatenationExpression failed");
    }

    // SQL String
    assertEquals("SqlConcatenationExpression must return an empty string",
        new SqlConcatenationExpression().toSqlString(), "");
    assertEquals("SqlConcatenationExpression must return \"a\"",
        new SqlConcatenationExpression().add(
            new MockSqlStringExpression("a")).toSqlString(), "a");
    assertEquals("SqlConcatenationExpression must return \"a || b\"",
        new SqlConcatenationExpression().add(
            new MockSqlStringExpression("a")).add(
            new MockSqlStringExpression("b")).toSqlString(),
        "a || b");

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

TOP

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

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.