/** * protected Hashtable[] doJDBC(String dbname_, String sql_, // Connection con, boolean goNative_, * long offset_, int maxsize_, boolean robotquery_, Connection con) throws SQLException */ public void init() throws Exception { try { if (!outcon) { tx = TransactionManager.getTransaction(); if (tx == null) { con = SQLUtil.getSQLManager().requestConnection(dbname); // 事务无处理,批处理的默认事务处理需要设定 if (needTransaction) { this.oldautocommit = con.getAutoCommit(); con.setAutoCommit(false); } } else { try { con = tx.getConnection(dbname); } catch (TransactionException e) { try { tx.setRollbackOnly(); } catch (Exception ei) { } throw e; } } } else { if (this.con != null && this.con instanceof TXConnection) { tx = TransactionManager.getTransaction(); } } } catch (Exception e) { throw e; } }
public int getScrollType(String dbname) { try { // JDBCPool pool = ((JDBCPool)SQLUtil.getSQLManager().getPool(dbname)); return this.dbadapter.getSCROLLType(pool.getDriver()); } catch (Exception e) { log.error(dbname, e); JDBCPool pool = ((JDBCPool) SQLUtil.getSQLManager().getPool(null)); return pool.getDbAdapter().getSCROLLType(pool.getDriver()); } }
public StatementInfo( String dbname_, NewSQLInfo sql_, boolean goNative_, long offset_, int maxsize_, boolean robotquery_, Connection con_, boolean needTransaction, String rownum, boolean prepared) { this.dbname = dbname_; if (this.dbname == null) this.dbname = SQLManager.getInstance().getDefaultDBName(); newsqlinfo = sql_; /** must be removed. */ pool = SQLUtil.getSQLManager().getPool(dbname); interceptorInf = pool.getInterceptor(); dbadapter = pool.getDbAdapter(); if (sql_ != null) sql = interceptorInf.convertSQL(sql_.getNewsql(), dbadapter.getDBTYPE(), dbname_); // this.sql = sql_; this.goNative = goNative_; this.offset = offset_; this.maxsize = maxsize_; this.robotquery = robotquery_; this.con = con_; this.outcon = con_ == null ? false : true; statements = new ArrayList(); this.rownum = rownum; this.prepared = prepared; resultSets = new ArrayList(); // neadGetGenerateKeys = DBUtil.getJDBCPoolMetaData(dbname).isNeadGetGenerateKeys(); // if (dbname == null) // this.dbname = SQLManager.getInstance().getDefaultDBName(); this.needTransaction = needTransaction; }