/* Use primer: mysql://foo@localhost/bar 0 /somepath/db /somepath/db/ db/ DO_ true Note that inner parameters correspond to DB_DataObject options. Thus, they are all optional and override the defaults. If is not present, DB_DataObject will not be loaded/initialized */ class AgaviMdb2Database extends AgaviDatabase { var $db; public function connect() { if (! $dsn = $this->getParameter('dsn')) throw new AgaviDatabaseException("Please define a DSN in database configuration"); if (PEAR::isError($db =& MDB2::connect($dsn))) throw new AgaviDatabaseException("Failed to connect to the database: " . $db->getMessage()); if ($do = $this->getParameter('dataobject')) { require_once 'DB/DataObject.php'; $do['database'] = $dsn; $options = &PEAR::getStaticProperty('DB_DataObject', 'options'); foreach($do as $key=>$value) $options[$key] = $value; } $this->connection = $db; } public function shutdown() { if ($this->db) $db->disconnect(); } }