Package com.bleujin.framework.db.procedure

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


public class P6_UserProceduresUpdate extends SampleTestBase{

  public void setUp() throws Exception {
    super.setUp() ;
    IUserCommand cmd = dc.createUserCommand("delete from update_sample") ;
    cmd.execUpdate() ;
  }
View Full Code Here


   */
 
  public void testUserProcedures() throws Exception {
    UserProcedures upts = dc.createUserProcedures("One Transaction") ;
   
    IUserCommand cmd = dc.createUserCommand("insert into update_sample values(?, ?)") ;
    cmd.addParam(1).addParam("abc") ;
   
    IUserCommand cmd2 = dc.createUserCommand("update update_sample set b = ? where a = ?") ;
    cmd2.addParam("___").addParam(1) // unique index exception
   
    int count = upts.add(cmd).add(cmd2).execUpdate() ;
    assertEquals(2, count) ;
   
    Rows rows = dc.getRows("select * from update_sample where a = 1") ;
View Full Code Here

 
  public void testSimpleTransaction() throws Exception {
   
    UserProcedures upts = dc.createUserProcedures("One Transaction") ;
   
    IUserCommand cmd = dc.createUserCommand("insert into update_sample values(?, ?)") ;
    cmd.addParam(1).addParam("abc") ;
   
    IUserCommand cmd2 = dc.createUserCommand("insert into update_sample values(?, ?)") ;
    cmd.addParam(1).addParam("abc") // unique index exception
   
    upts.add(cmd).add(cmd2) ;
   
    try {
View Full Code Here

    private long execCommandArray(int limit, String longString) throws SQLException {
        UserProcedures case1 = dc.createUserProcedures("noneBatch") ;

        long start = System.currentTimeMillis() ;
        for (int i = 0, last = limit; i < last; i++) {
            IUserCommand command = dc.createUserCommand("insert into BLEU## values(?,?,?)") ;
            command.addParam(0, i); ;
            command.addParam(1, "abcdefg"); ;
            command.addClob(2, longString); ;
            case1.add(command) ;
        }
        case1.execUpdate() ;
        long end = System.currentTimeMillis() ;
        return end - start ;
View Full Code Here

    }


    public void xtestClobInsert() throws Exception {
        IUserCommand command = dc.createUserCommand("insert into aaa## values(?,?,?,?)") ;
        command.addParam(0, 1); ;
        command.addParam(1, "��������"); ;
        command.addClob(2, getLongString()); ;
        command.addBlob(3, new FileInputStream("c:/temp/article.csv"));

        command.execUpdate() ;
    }
View Full Code Here

public class ViewPlan extends SampleTestBase{

  private String query = "select * from emp_sample x1, dept_sample x2 where x1.deptno = x2.deptno order by x1.empno" ;

  public void testViewPlan() throws Exception {
    IUserCommand cmd = dc.createUserCommand(query) ;

    cmd.printPlan(System.out) ;
  }
View Full Code Here

 
  String query1 = "select * from copy_sample order by no1" ;
 
  public void testDefaultLimit() throws Exception {
    dc.setLimitedRows(20) ;
    IUserCommand cmd = dc.createUserCommand(query1) ;
   
    Rows rows = cmd.execQuery() ;
    assertEquals(20, rows.getRowCount()) ;

    rows.absolute(20) ;
    assertEquals(20, rows.getInt("no2")) ;
  }
View Full Code Here

    assertEquals(20, rows.getInt("no2")) ;
  }
 
 
  public void testNextPage() throws Exception {
    IUserCommand cmd = dc.createUserCommand(query1) ;
    cmd.setPage(Page.create(10, 1))
   
    Rows rows = cmd.execQuery() ; // 1page
    assertEquals(10, rows.getRowCount()) ;
    assertEquals(1, rows.firstRow().getInt("no2")) ;
   
   
    Rows nextRows = rows.nextPageRows() ; // 2page
View Full Code Here

    assertEquals(11, nextRows.firstRow().getInt("no2")) ;
  }

 
  public void testPrePage() throws Exception {
    IUserCommand cmd = dc.createUserCommand(query1) ;
    cmd.setPage(Page.create(10, 2)) // 2page
   
    Rows rows = cmd.execQuery() ;
    assertEquals(10, rows.getRowCount()) ;
    assertEquals(11, rows.firstRow().getInt("no2")) ;
   
   
    Rows preRows = rows.prePageRows() // 1page
View Full Code Here

    int unitCount = 100 ;
   
    StopWatch sw = new StopWatch() ;
    sw.start() ;
    for (int i = 0; i < unitCount; i++) {
      IUserCommand cmd = dc.createUserCommand("insert into performance_sample(a, b, c) values(?, ?, ?)") ;
      cmd.addParam(0, unitCount + i) ;
      cmd.addParam(1, "No." + (unitCount + i) + ".....") ;
      cmd.addParam(2, RandomUtil.nextRandomString(RandomUtil.nextRandomInt(10, 50), RandomUtil.NUMBER_CHAR_TYPE)) ;
      cmd.execUpdate() ;
    }
    Debug.debug(sw.getTime()) ;
    assertEquals(true, unitCount * 50 > sw.getTime()) ;
    sw.stop() ;
  }
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.