Package com.bleujin.framework.db

Examples of com.bleujin.framework.db.Rows



  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


      this.stmtSQL = stmtSQL ;
    }

    @Override
    protected Rows myQuery(Connection conn) throws SQLException {
        Rows result = null ;
        ResultSet rs = null ;

        try {
            pstmt = conn.prepareStatement(getStmtSQL(),  ResultSet.TYPE_SCROLL_INSENSITIVE,  ResultSet.CONCUR_READ_ONLY) ;
View Full Code Here

 
  public void testProcedure() throws Exception {
    IUserProcedure cmd = dc.createUserProcedure("common@testBy()") ;
    cmd.setPage(Page.TEN) ;
   
    Rows rows = cmd.execQuery();
    assertEquals(10, rows.getRowCount()) ;
  }
View Full Code Here

 
  public void test2Page() throws Exception {
    IUserProcedure cmd = dc.createUserProcedure("common@testBy()") ;
    cmd.setPage(Page.create(10, 2)) ;
   
    Rows rows = cmd.execQuery();
    assertEquals(10, rows.getRowCount()) ;
    Debug.debug(rows) ;
  }
View Full Code Here

    IUserProcedure upt = dc.createUserProcedure("common@testBy()") ;
    upt.setPage(Page.create(10, 2)) ;
   
    upts.add(cmd).add(upt) ;
   
    Rows rows = upts.execQuery() ;
    assertEquals(10, rows.getRowCount()) ;
   
    Rows nextRows = rows.getNextRows() ;
    assertEquals(10, nextRows.getRowCount()) ;
  }
View Full Code Here

 
  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)) ;

    assertEquals(true, rows.firstRow().getInt(2) < nextPageRows.firstRow().getInt(2)) ;

    Rows prePageRows = rows.prePageRows() ;
    assertEquals(1, prePageRows.firstRow().getInt(2)) ;
  }
View Full Code Here

public class UseHandler extends SampleTestBase {

  String query = "select * from copy_sample order by no1" ;
 
  public void testMapHandler() throws Exception {
    Rows rows = dc.getRows(query, 10, 1) ;
    Map results = (Map)rows.toHandle(new MapHandler()) ;
   

    assertEquals(2, results.size()) ;

    assertEquals("1", results.get("no1").toString()) ;
View Full Code Here

    assertEquals("01", results.get("no2")) ;
  }
 
 
  public void testMapList() throws Exception {
    Rows rows = dc.getRows(query, 10, 1) ;
   
    List<Map> results = (List<Map>)rows.toHandle(new MapListHandler()) ;
   
    assertEquals(10, results.size()) ;
    Map row = results.get(0);
   
    assertEquals("1", row.get("no1").toString()) ;
View Full Code Here

    assertEquals("01", row.get("no2")) ;
  }
 
 
  public void testBeanList() throws Exception {
    Rows rows = dc.getRows(query, 10, 1) ;
   
    List<TestBean> results = (List<TestBean>)rows.toHandle(new BeanListHandler(TestBean.class)) ;
    assertEquals(10, results.size()) ;

    TestBean row = results.get(0);
    assertEquals(1, row.getNo1()) ;
    assertEquals("01", row.getNo2()) ;
View Full Code Here

    assertEquals("02", results.get(1).getNo2()) ;
 
  }
 
  public void testScalar() throws Exception {
    Rows rows = dc.getRows(query, 10, 1) ;
    Object value = rows.toHandle(new ScalarHandler()) ;
   
    assertEquals("1", value.toString()) ;
   
   
    rows = dc.getRows(query, 10, 1) ;
    Object secondValue = rows.toHandle(new ScalarHandler(2)) ;
    assertEquals("01", secondValue) ;
  }
View Full Code Here

TOP

Related Classes of com.bleujin.framework.db.Rows

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.