Package org.araneaframework.backend.list.sqlexpr.constant

Examples of org.araneaframework.backend.list.sqlexpr.constant.SqlStringExpression


    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


    }
  }
 
  class VariableTranslator implements ExprToSqlExprTranslator {
    public SqlExpression translate(Expression expr, ExpressionToSqlExprBuilder builder) {
      return new SqlStringExpression(resolveVariable((Variable) expr));
    }
View Full Code Here

      return new SqlDescendingExpression(translateVariableComparatorInternal(compExpr));
    }
  }
 
  SqlExpression translateVariableComparatorInternal(VariableComparatorExpression compExpr) {
    SqlExpression temp = new SqlStringExpression(resolveVariable(compExpr));
    Comparator comparator = compExpr.getComparator();
    if (comparator instanceof NullComparator) {
      comparator = ((NullComparator) comparator).getNotNullComparator();
    }
    log.debug("Comparator: " + comparator);
View Full Code Here

  public void testSqlStringExpression() {
    log.debug("Testing SqlStringExpression");
    // constructing
    try {
      new SqlStringExpression("");
    } catch (Exception e) {
      fail("Constructing of SqlStringExpression failed with empty string");
    }
    try {
      new SqlStringExpression("a");
    } catch (Exception e) {
      fail("Constructing of SqlStringExpression failed with non-empty string");
    }
    try {
      new SqlStringExpression("a", new Object[0]);
    } catch (Exception e) {
      fail("Constructing of SqlStringExpression failed with non-empty string and an empty array");
    }
    try {
      new SqlStringExpression("a", new Object[] { "b", "c" });
    } catch (Exception e) {
      fail("Constructing of SqlStringExpression failed with non-empty string and two values");
    }
    try {
      new SqlStringExpression(null);
      fail("SqlStringExpression's string can not be null");
    } catch (Exception e) {
      // normal
    }
    try {
      new SqlStringExpression("a", null);
      fail("SqlStringExpression's values array can not be null");
    } catch (Exception e) {
      // normal
    }

    // SQL String
    assertEquals("SqlStringExpression must return an empty string",
        new SqlStringExpression("").toSqlString(), "");
    assertEquals("SqlStringExpression must return \"a\"",
        new SqlStringExpression("a").toSqlString(), "a");

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

TOP

Related Classes of org.araneaframework.backend.list.sqlexpr.constant.SqlStringExpression

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.