/** * Subclasses should call parent::tearDown() after * doing their own logic, e.g. deleting metadata. */ public function tearDown() { if (isset($this->_util) && $this->_util->isEnabled()) { $this->_util->tearDown(); } if ($this->_db) { $this->_db->closeConnection(); $this->_db = null; } }
/** * Delegate to the database adapter. * * @param string $m Method name. * @param array $a Method arguments. * @return mixed */ public function __call($m, $a) { if (!method_exists($this->_adapter, $m)) { throw new BadMethodCallException("Method named '{$m}' does not exist or is not callable."); } // Log SQL for certain adapter calls. $logFor = array('fetchOne', 'fetchAll', 'prepare', 'query', 'fetchRow', 'fetchAssoc', 'fetchCol', 'fetchPairs'); if (in_array($m, $logFor)) { $this->log($a[0]); } try { return call_user_func_array(array($this->_adapter, $m), $a); // Zend_Db_Statement_Mysqli does not consider a connection that returns // a "MySQL server has gone away" error to be disconnected. Catch these // errors, close the connection, and reconnect, then retry the query. } catch (Zend_Db_Statement_Mysqli_Exception $e) { if (2006 == $e->getCode()) { $this->_adapter->closeConnection(); $this->_adapter->getConnection(); return call_user_func_array(array($this->_adapter, $m), $a); } throw $e; } }
/** * Close this connection. * * @return void */ public function close() { $this->_connection->closeConnection(); }
public function closeConnection() { $this->_db->closeConnection(); }
/** * Force the connection to close. * * @return void */ public function closeConnection() { return $this->_adapter->closeConnection(); }
public function tearDown() { $this->dropTable(); $this->dropSequence(); $this->_db->closeConnection(); }
/** * Subclasses should call parent::tearDown() after * doing their own logic, e.g. deleting metadata. */ public function tearDown() { $this->_util->tearDown(); $this->_db->closeConnection(); $this->_db = null; }