Package com.bleujin.framework.db

Examples of com.bleujin.framework.db.DBController


    bean.setAddress("jdbc:h2:127.0.0.1/test") ;
  }
 
  public void testSelect() throws Exception {
    H2EmbedDBManager hdbm = new H2EmbedDBManager(bean) ;
    DBController dc = new DBController(hdbm) ;
    dc.initSelf() ;
   
    dc.createUserCommand("create table if not exists test(a int, b varchar(20))").execUpdate() ;
    dc.createUserCommand("insert into test values(1, 'BlaBla')").execUpdate() ;
   
    Rows rows = dc.createUserCommand("select * from test" ).execQuery() ;
    Debug.debug(rows) ;
   
    dc.destroySelf() ;
  }
View Full Code Here


  protected DBManager dbm;
  protected DBController dc;

  public void setUp() throws Exception {
    dbm = new H2EmbedPoolDBManager("webapps/simple/WEB-INF/h2-config.xml");
    dc = new DBController("test", dbm, new StdOutServant());
    dc.initSelf() ;
  }
View Full Code Here

public class MySQLMother extends TestCase{

  protected DBController dc ;
  public void setUp() throws Exception {
    MySQLDBManager dbm = new MySQLDBManager("jdbc:mysql://novision/test", "bleu", "redf") ;
    dc = new DBController("mysql", dbm, new StdOutServant()) ;
    dc.initSelf() ;
   
  }
View Full Code Here

    protected DBManager dbm = null ;
    private UserProcedures upts;

    TxTransaction(IDBController dc, String name) {
        this.dbm = dc.getDBManager() ;
        this.upts = new DBController(this.dbm).createUserProcedures(name) ;
    }
View Full Code Here

    {
      IQueryable query = atask.getQueryable() ;
        final String procName = query.getProcSQL() ;
        final String procFullName = query.getProcFullSQL() ;
        final int misecond = Integer.parseInt(String.valueOf(atask.getEnd() - atask.getStart())) ;
        final DBController dc = new DBController(atask.getDBManager()) ;
        new Thread(){
            public void run(){
                try {
                    IUserProcedure upt = dc.createUserProcedure("OnlyAdmin@addLongTimeProcedure(?,?,?)") ;
                    upt.addParam(0, procName) ;
                    upt.addParam(1, procFullName.length() > 1000 ? procFullName.substring(0, 1000) : procFullName) ;
                    upt.addParam(2, misecond) ;
                    upt.execUpdate() ;
                }
View Full Code Here

    protected boolean commitFinished;
    protected int transStatus;

    public WeakTxTransaction(IDBController dc, String name, boolean dbmDestroyed) {
        this.dbm = dc.getDBManager();
        this.upts = new DBController(this.dbm).createUserProcedures(name) ;
        this.dbmDestroyed = dbmDestroyed;
    }
View Full Code Here

public class MSSQLUserCommandPlan implements PlanPrintable {

  private DBController dc ;
  private IUserCommand cmd ;
  public MSSQLUserCommandPlan(IDBController dc, IUserCommand cmd) {
    this.dc = new DBController(dc.getDBManager()) ; // none servant
    this.cmd = cmd ;
  }
View Full Code Here

  public void testSimple() throws Exception {
   
    // prepare
    MSSQLDBManager mManager = new MSSQLDBManager("jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=test", "bleu", "redf");
    DBController mdc = new DBController(mManager) ;
    mdc.initSelf() ;

    OracleDBManager oManager = new OracleDBManager("jdbc:oracle:thin:@novision:1521:al", "al", "redf") ;
    DBController odc = new DBController(oManager) ;
    odc.initSelf() ;
   
   
    // tx1 : mssql
    TxTransaction tx1 = new MSSQL2000TxTransaction(mManager, "mquery") ;
    tx1.add((Queryable)mdc.createUserCommand("insert into copy_tblc values('111', 111)")) ;
   
    // tx2 : oracle
    TxTransaction tx2 = new Oracle9iTxTransaction(oManager, "oquery") ;
    tx2.add((Queryable)odc.createUserCommand("insert into copy_tblc values('111', 111)")) ;
   

    // add tx
    TxTransaction[] txs = new TxTransaction[]{tx1, tx2} ;
    XAUserProcedure upts = new XAUserProcedure(txs) ;
    upts.execUpdate() ;
   
    // clear
    mdc.destroySelf() ;
    odc.destroySelf() ;
  }
View Full Code Here

    Oracle9iTxTransaction() {
        this(new OracleDBManager("jdbc:oracle:thin:@novision:1525:DB9I", "odin", "odin"), "test");
    };

    public Oracle9iTxTransaction(OracleDBManager dbm, String name) {
        super(new DBController(dbm), name);
    }
View Full Code Here

public class MySQLUserCommandPlan implements PlanPrintable{

  private DBController dc ;
  private IUserCommand cmd ;
  public MySQLUserCommandPlan(IDBController dc, IUserCommand cmd) {
    this.dc = new DBController(dc.getDBManager()) ; // none servant
    this.cmd = cmd ;
  }
View Full Code Here

TOP

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

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.