Package com.bleujin.framework.db.procedure

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


   

   
    public void handleServant(long start, long end, IQueryable query, int execType){
        if (query instanceof UserProcedures) {
            UserProcedures uprocs = (UserProcedures)query ;
            for (int i = 0, last = uprocs.size(); i < last; i++) {
                handleServant(start, end, uprocs.getQuery(i), execType);
            }
        }
        else {
            try {
                echannel.putTask(new AfterTask(start, end, this.getDBManager(), query, execType));
View Full Code Here


    System.out.println("count:" + rows.getInt(1));
  }

  public void xtestReset() throws Exception {
    UserProcedures recreate = dc.createUserProcedures("reset");
    recreate.add(dc.createUserProcedure("db@resetTable"));

    recreate.execUpdate();
  }
View Full Code Here

    recreate.execUpdate();
  }

  public void testRecreate() throws Exception {
    UserProcedures recreate = dc.createUserProcedures("recreate");
    recreate.add(dc.createUserProcedure("db@dropTable"));
    recreate.add(dc.createUserProcedure("db@createTable"));

    recreate.execUpdate();
  }
View Full Code Here

    this.chain = makeChainProcedure(stmtSQL);

  }

  private UserProcedures makeChainProcedure(String stmtSQL) {
    UserProcedures chain = getDBController().createUserProcedures(procName) ;
    String[] queryStr = StringUtil.split(stmtSQL, ";");
    for (int i = 0; i < queryStr.length; i++) {
      if (StringUtil.isBlank(queryStr[i])) continue ;
      H2UserProcedure cmd = (H2UserProcedure)getDBController().createParameterQuery(queryStr[i]);
      cmd.addNamedParam(this.getNamedParam());

      chain.add(cmd);
    }
    return chain ;
  }
View Full Code Here

    public void tearDown() throws Exception {
        super.tearDown();
    }

    public void xtestCase1() throws Exception{
        UserProcedures upts = dc.createUserProcedures("Case1") ;

        long start = System.currentTimeMillis() ;

        IUserProcedure[] upt = new UserProcedure[MaxTryCount];
        for (int i = 0; i < upt.length; i++) {
            upt[i] = dc.createUserProcedure("LobTest@insertBatch(?,?)") ;
            upt[i].addParam(0, i);
            upt[i].addParam(1, "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789");
            upts.add(upt[i]) ;
        }
        upts.execUpdate() ;
        long end = System.currentTimeMillis() ;

        System.out.println("Case 1 (end - start)="+ (end - start));
    }
View Full Code Here

        System.out.println("Case 3 (end - start)="+ (end - start));
    }

    public void xtestCase21() throws Exception{
        UserProcedures upts = dc.createUserProcedures("Case1") ;

        long start = System.currentTimeMillis() ;

        String str = "1234567890" ;
        String lstr = "" ;
        for (int i = 0; i < 1000; i++) {
            lstr += str ;
        }

        IUserProcedure[] upt = new UserProcedure[MaxTryCount];
        for (int i = 0; i < upt.length; i++) {
            upt[i] = dc.createUserProcedure("LobTest@insertClob(?,?)") ;
            upt[i].addParam(0, i);
            upt[i].addClob(1, lstr);
            upts.add(upt[i]) ;
        }
        upts.execUpdate() ;
        long end = System.currentTimeMillis() ;

        System.out.println("Case 1 (end - start)="+ (end - start));
    }
View Full Code Here

    assertEquals(10, rows.getRowCount()) ;
    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) ;
   
    Rows rows = upts.execQuery() ;
    assertEquals(10, rows.getRowCount()) ;
   
    Rows nextRows = rows.getNextRows() ;
    assertEquals(10, nextRows.getRowCount()) ;
  }
View Full Code Here

      synchronized (this) {
        if (execType == IQueryable.UPDATE_COMMAND) modify_count++ ;
    }
     
        if (query instanceof UserProcedures) {
            UserProcedures uprocs = (UserProcedures)query ;
            for (int i = 0, last = uprocs.size(); i < last; i++) {
                handleServant(start, end, uprocs.getQuery(i), execType);
            }
        }
        else {
            try {
                echannel.putTask(new AfterTask(start, end, this.getDBManager(), query, execType));
View Full Code Here

    IUserCommand cmd1 = dc.createUserCommand("insert into update_sample values(?, ?)") ;
    cmd1.addParam(1).addParam("abc") ;
    IUserCommand cmd2 = dc.createUserCommand("delete from update_sample where a = ?") ;
    cmd2.addParam(1);
   
    UserProcedures upts = dc.createUserProcedures("Multi MDL") ;
    upts.add(cmd1).add(cmd2) ;
    int result = upts.execUpdate() ;
    assertEquals(2, result) ;
  }
View Full Code Here

  public void testMultiQuery() throws Exception {
    IUserCommand cmd1 = dc.createUserCommand("select * from copy_sample") ;
    cmd1.setPage(Page.create(10, 1)) ;
    IUserCommand cmd2 = dc.createUserCommand("select 3 from dept_sample") ;
   
    UserProcedures upts = dc.createUserProcedures("Multi Query") ;
    upts.add(cmd1).add(cmd2) ;
   
    Rows first = upts.execQuery() // first query result ;
    assertEquals(true, first.getRowCount() == 10) ;
   
    Rows second = first.getNextRows() ; // second query result ;
    assertEquals(3, second.firstRow().getInt(1)) ;
   
View Full Code Here

TOP

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

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.