Mike Vincent wrote:

Would you mind attaching it?

-Mike

The DocBlock headers might need some tweaking, but otherwise it should be quite useable. DatabaseException If a connection could not be created. * * @author Daniel Swarbrick ([EMAIL PROTECTED]) * @since 0.9.0 */ public function connect () { // determine how to get our parameters $method = $this->getParameter('method', 'dsn'); // get parameters switch ($method) { case 'dsn' : $dsn = $this->getParameter('dsn'); if ($dsn == null) { // missing required dsn parameter $error = 'Database configuration specifies method ' . '"dsn", but is missing dsn parameter'; throw new DatabaseException($error); } break; } try { $this->connection = new PDO($dsn); } catch (PDOException $e) { throw new DatabaseException($e->getMessage()); } // lets generate exceptions instead of silent failures $this->connection->setAttribute(PDO_ATTR_ERRMODE, PDO_ERRMODE_EXCEPTION); } // ------------------------------------------------------------------------- /** * Execute the shutdown procedure. * * @return void * * @throws DatabaseException If an error occurs while shutting down * this database. * * @author Daniel Swarbrick ([EMAIL PROTECTED]) * @since 0.9.0 */ public function shutdown () { if ($this->connection !== null) { @$this->connection = null; } } } ?>
_______________________________________________
agavi-dev mailing list
[email protected]
http://labworkz.com/cgi-bin/mailman/listinfo/agavi-dev

Reply via email to