Beispiel #1
0
 public void testLstmtMultilineArgs() throws ZException, ZQLException {
   ZQL zql = new ZQL("test hello\nworld");
   List<Z> zList = zql.compile();
   assertEquals(1, zList.size());
   Z q = zList.get(0);
   assertEquals("select *\nfrom () a\nlimit hello\nworld;", q.getQuery());
   q.release();
 }
Beispiel #2
0
 public void testLstmtSimple() throws ZException, ZQLException {
   ZQL zql = new ZQL("test");
   List<Z> zList = zql.compile();
   assertEquals(1, zList.size());
   Z q = zList.get(0);
   assertEquals("select *\nfrom () a\nlimit ;", q.getQuery());
   q.release();
 }
Beispiel #3
0
  public void testSemicolon() throws ZException, ZQLException {
    ZQL zql = new ZQL();
    zql.append(
        "create table if not exists bank(a INT); select * from bank | select * from <%= z."
            + Q.INPUT_VAR_NAME
            + " %> limit 10; show tables; ");
    List<Z> plan = zql.compile();

    assertEquals(3, plan.size());
    assertEquals(
        "select * from " + plan.get(1).prev().name() + " limit 10", plan.get(1).getQuery());
    assertEquals("show tables", plan.get(2).getQuery());

    for (Z query : plan) {
      assertNotNull(query.getConnection());
    }
  }
Beispiel #4
0
 public void testLstmtParamErb() throws ZException, ZQLException {
   ZQL zql = new ZQL("test(limit=<%='20'%>)");
   Z q = zql.compile().get(0);
   assertEquals("select *\nfrom () a\nlimit 20;", q.getQuery());
 }