Re: DB_QueryTool, MDB_QueryTool, and error handling
| From: | Mark Wiesemann | Date: | Sat, 25 Oct 2008 13:24:09 +0000 |
| Subject: | Re: DB_QueryTool, MDB_QueryTool, and error handling | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-50913@lists.php.net to get a copy of this message | ||
Daniel O'Connor wrote:
> In a nutshell, connection to the database happens in the constructor in both
> of these packages, and if it's wrong, an error object is returned.
>
> My first instincts are to raise an exception (but can't because it's a PHP4
> package), or explicitly pass in the database connection object (that would
> be a BC break, but improves testability)
You could maybe do it like Paul M. Jones did it in DB_Table by adding a
new (public) property $error that is filled if an error occures in the
constructor. People can test this property with PEAR::isError() after
calling the constructor.
Regards,
Mark
--
http://www.markwiesemann.eu