Package com.bleujin.framework.db.procedure

Examples of com.bleujin.framework.db.procedure.IUserCommand


  }
 
  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 testInsert() throws Exception {
    dc.createUserCommand("truncate table lob_sample") ;
    IUserCommand cmd = dc.createUserCommand("insert into lob_sample(a, b, c, d, e) values(:a, :b, :c, :d, :e)") ;
    cmd.addParam("a", 1) ;
    cmd.addClob("b", "abcdefg") ;
    cmd.addClob("c", FileUtils.readFileToString(k100File, "UTF-8")) ;
    cmd.addBlob("d", new FileInputStream(k100File)) ;
    cmd.addParam("e", "12345") ;
    int result = cmd.execUpdate() ;
   
    assertEquals(1, result) ;
   
    Rows rows = dc.getRows("select a, b, c, d, e from lob_sample where a = 1") ;
   
View Full Code Here

    dc.execUpdate("delete from update_sample") ;
    dc.execUpdate("truncate table performance_sample") ;
  }
 
  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()) ;
 
  }
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) ;

    Rows rows = cmd.execQuery() ;
    assertEquals(1, rows.getRowCount()) ;
  }
View Full Code Here

    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") ;
    cmd.addParam(0, 19) ;
    cmd.addParam("no1", 20) ;
   
    Rows rows = cmd.execQuery() ;
    assertEquals(2, rows.getRowCount()) ;
  }
View Full Code Here

    Page page = Page.create(10, 1) ;
    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

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


  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()) ;
 
View Full Code Here

    Rows rows = cmd.execQuery();
    assertEquals(10, rows.getRowCount()) ;
  }
 
  public void testHandleBean() throws Exception {
    IUserCommand cmd = dc.createUserCommand("select * from copy_tblc") ;
    cmd.setPage(Page.TEN) ;
   
    List<TestBean> beans =  (List<TestBean>)(cmd.execQuery().toHandle(new BeanListHandler(TestBean.class))) ;
    assertEquals(10, beans.size()) ;
  }
View Full Code Here

    Debug.debug(rows) ;
  }
 
  public void testUserProcedures() throws Exception {
    UserProcedures upts = dc.createUserProcedures("composite") ;
    IUserCommand cmd = dc.createUserCommand("select * from copy_tblc") ;
    cmd.setPage(Page.TEN) ;

    IUserProcedure upt = dc.createUserProcedure("common@testBy()") ;
    upt.setPage(Page.create(10, 2)) ;
   
    upts.add(cmd).add(upt) ;
View Full Code Here

    Rows nextRows = rows.getNextRows() ;
    assertEquals(10, nextRows.getRowCount()) ;
  }
 
  public void testNextPage() throws Exception {
    IUserCommand cmd = dc.createUserCommand("select * from copy_tblc") ;
    cmd.setPage(Page.TEN) ;

    Rows rows = cmd.execQuery();
    assertEquals(10, rows.getRowCount()) ;
   
   
    Rows nextPageRows = rows.nextPageRows() ;
    assertEquals(11, nextPageRows.firstRow().getInt(2)) ;
View Full Code Here

TOP

Related Classes of com.bleujin.framework.db.procedure.IUserCommand

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.