| // +----------------------------------------------------------------------+ // // $Id: DB.php,v 1.1 2006-12-14 15:04:29 jp_milcent Exp $ // require_once 'DB.php'; // {{{ DB_NestedSet_DB:: class /** * Wrapper class for PEAR::DB * * @author Daniel Khan * @package DB_NestedSet * @version $Revision: 1.1 $ * @access public */ // }}} class DB_NestedSet_DB extends DB_NestedSet { // {{{ properties /** * @var object Db object */ var $db; // }}} // {{{ constructor /** * Constructor * * @param mixed $dsn DSN as PEAR dsn URI or dsn Array * @param array $params Database column fields which should be returned * */ function DB_NestedSet_DB($dsn, $params = array()) { $this->_debugMessage('DB_NestedSet_DB($dsn, $params = array())'); $this->DB_NestedSet($params); $this->db =& $this->_db_Connect($dsn); $this->db->setFetchMode(DB_FETCHMODE_ASSOC); } // }}} // {{{ destructor /** * Destructor */ function _DB_NestedSet_DB() { $this->_debugMessage('_DB_NestedSet_DB()'); $this->_DB_NestedSet(); $this->_db_Disconnect(); } // }}} // {{{ _db_Connect() /** * Connects to the db * * @return object DB The database object * @access private */ function &_db_Connect($dsn) { $this->_debugMessage('_db_Connect($dsn)'); if (is_object($this->db)) { return $this->db; } $db =& DB::connect($dsn); $this->_testFatalAbort($db, __FILE__, __LINE__); return $db; } // }}} function _numRows($res) { return $res->numRows(); } function _isDBError($err) { if(!DB::isError($err)) { return false; } return true; } function _quote($str) { return $this->db->quote($str); } // {{{ _db_Disconnect() /** * Disconnects from db * * @return void * @access private */ function _db_Disconnect() { $this->_debugMessage('_db_Disconnect()'); if (is_object($this->db)) { @$this->db->disconnect(); } return true; } // }}} } ?>