Package com.bleujin.framework.db.procedure

Examples of com.bleujin.framework.db.procedure.IUserCommand.execQuery()


public class TestPage extends MySQLMother{

  public void testPage() throws Exception {
    final IUserCommand cmd = dc.createUserCommand("select * from millon_tblt") ;
    cmd.setPage(Page.TEN) ;
    Rows rows = cmd.execQuery();
   
    assertEquals(10, rows.getRowCount()) ;
  }
 
  public void testLimit() throws Exception {
View Full Code Here


  }
 
  public void testLimit() throws Exception {
    final IUserCommand cmd = dc.createUserCommand("select * from millon_tblt limit ?,?") ;
    cmd.addParam(10).addParam(10) ;
    Rows rows = cmd.execQuery();
   
    assertEquals(10, rows.getRowCount()) ;
  }
 
 
View Full Code Here

  public void testParameter() throws Exception {
    IUserCommand cmd = dc.createUserCommand("select * from millon_tblt limit ?");
    cmd.addParam(10) ;

    Debug.debug(cmd) ;
    Debug.debug(cmd.execQuery().firstRow());
  }
}
View Full Code Here

  public void testRowsPageMethod2() throws Exception {
    String query = "select * from copy_sample" ;
   
    IUserCommand cmd = dc.createUserCommand(query) ;
    cmd.setPage(Page.create(1, 1)) ;
    Rows rows = cmd.execQuery() ;
    assertEquals(1, rows.getRowCount()) ;
  }

 
 
View Full Code Here

 
  public void testNamedParameter() throws Exception {
    IUserCommand cmd = dc.createUserCommand("select * from copy_sample where no1 >= :no1 and no1 <= :no1") ;
    cmd.addParam("no1", 20) ;
   
    Rows rows = cmd.execQuery() ;
    assertEquals(1, rows.getRowCount()) ;
 
  }

  public void testNamedParameterConflict() throws Exception {
View Full Code Here

  public void testNamedParameterConflict() throws Exception {
    try {
      IUserCommand cmd = dc.createUserCommand("select ':abc' from copy_sample where no1 >= :no1 and no1 <= :no1") ;
      cmd.addParam("no1", 20) ;
      cmd.execQuery() ;
      fail() ;
    } catch (IllegalArgumentException ignore){}

    IUserCommand cmd = dc.createUserCommand("select 'a:1' from copy_sample where no1 >= :no1 and no1 <= :no1") ;
    cmd.addParam("no1", 20) ;
View Full Code Here

    } catch (IllegalArgumentException ignore){}

    IUserCommand cmd = dc.createUserCommand("select 'a:1' from copy_sample where no1 >= :no1 and no1 <= :no1") ;
    cmd.addParam("no1", 20) ;

    Rows rows = cmd.execQuery() ;
    assertEquals(1, rows.getRowCount()) ;
  }

  public void testNamedParameter2() throws Exception {
    IUserCommand cmd = dc.createUserCommand("select * from copy_sample where no1 >= ? and no1 <= :no1") ;
View Full Code Here

  public void testNamedParameter2() throws Exception {
    IUserCommand cmd = dc.createUserCommand("select * from copy_sample where no1 >= ? and no1 <= :no1") ;
    cmd.addParam(0, 19) ;
    cmd.addParam("no1", 20) ;
   
    Rows rows = cmd.execQuery() ;
    assertEquals(2, rows.getRowCount()) ;
  }
 
 
 
View Full Code Here

    assertEquals(0, page.getStartLoc()) ;
  }
 
  public void testDefault() throws Exception {
    IUserCommand cmd = dc.createUserCommand("select * from copy_tblc") ;
    Rows rows = cmd.execQuery();

    assertEquals(true, rows.getRowCount() > 10) ;
  }


View Full Code Here


  public void testPage() throws Exception {
    final IUserCommand cmd = dc.createUserCommand("select * from millon_tblt") ;
    cmd.setPage(Page.TEN) ;
    Rows rows = cmd.execQuery();
   
    assertEquals(10, rows.getRowCount()) ;
 
 
  public void testProcedure() throws Exception {
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.