Package org.araneaframework.backend.list.sqlexpr

Examples of org.araneaframework.backend.list.sqlexpr.SqlCollectionExpression


   *
   * @return the fields <code>SqlExpression</code>, which can be used in
   *         "SELECT" clause.
   */
  protected SqlExpression getFieldsSqlExpression() {
    SqlCollectionExpression fields = new SqlCollectionExpression();
   
    Collection variables = new HashSet(this.variableToDatabaseMapping.values());   
    Iterator i = variables.iterator();
    while (i.hasNext()) {
      fields.add(new SqlStringExpression((String) i.next()));
    }
    return fields;
  }
View Full Code Here


    return this.mapper != null ? (String) this.mapper.resolve(variable) : variable.getName();
  }
 
  class MultiComparatorTranslator extends CompositeCompExprToSqlExprTranslator {
    protected SqlExpression translateParent(ComparatorExpression expr, SqlExpression[] sqlChildren) {
      return new SqlCollectionExpression().setChildren(sqlChildren);
    }
View Full Code Here

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

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

    // SQL arguments
    assertTrue("SqlCollectionExpression must return an empty array", Arrays
        .equals(new SqlCollectionExpression().getValues(),
            new Object[0]));
    assertTrue("SqlCollectionExpression must return an empty array",
        Arrays
            .equals(
                new SqlCollectionExpression().add(
                    new MockSqlStringExpression(
                        new Object[0])).add(
                    new MockSqlStringExpression(
                        new Object[0])).getValues(),
                new Object[0]));
    assertTrue(
        "SqlCollectionExpression must return (\"a\", \"b\") as values",
        Arrays.equals(new SqlCollectionExpression().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.SqlCollectionExpression

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.