Re: DB_QueryTool, MDB_QueryTool, and error handling

From: Date: Sat, 25 Oct 2008 08:21:54 +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-50910@lists.php.net to get a copy of this message
Hello Daniel, > Does anyone have suggestions on good approaches to fix: > http://pear.php.net/bugs/bug.php?id=14862 > > 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) MDB2 itself "fixes" the problem by returning a PEAR_Error object in the factory method. Since you're using a constructor, this isn't possible :/ But you could add a factory method. Putting all those error checks in all methods might be an overkill. -- Regards/Mit freundlichen Grüßen Christian Weiske -= Geeking around in the name of science since 1982 =-

Attachment: [application/pgp-signature] signature.asc
« previous php.pear.dev (#50910) next »