Exemple #1
0
 protected function setUp()
 {
     $dsn = Q::ini('db_dsn_pool/default');
     if (empty($dsn)) {
         Q::changeIni('db_dsn_pool/default', Q::ini('db_dsn_mysql'));
     }
     $this->dbo = QDB::getConn();
     $this->dbo->connect();
 }
Exemple #2
0
 /**
  * 设置数据库访问对象
  *
  * @param QDB_Adapter_Abstract $conn
  */
 function setConn(QDB_Adapter_Abstract $conn)
 {
     $this->_conn = $conn;
     if (!$this->_conn->isConnected()) {
         $this->_conn->connect();
     }
     if (empty($this->schema)) {
         $this->schema = $conn->getSchema();
     }
     if (empty($this->prefix)) {
         $this->prefix = $conn->getTablePrefix();
     }
 }