Re: [db] Catching mysql_connect errors with set_error_handler ?

From: Date: Fri, 13 Apr 2001 19:29:32 +0000
Subject: Re: [db] Catching mysql_connect errors with set_error_handler ?
References: 1 2 3 4 5  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-220@lists.php.net to get a copy of this message
Markus Fischer wrote: > > On Fri, Apr 13, 2001 at 05:09:50PM +0200, Tomas V.V.Cox wrote : > > I see now, yes if no valid link, mysq_errno() won't work. But there is a > > easy way to catch this particular error, something like: > > > > ini_set ('track_errors','1'); > > $con = @mysql_connect( 'localhost:/var/socken', 'user', > > 'pass'); > > if (!empty($php_errormsg) && ($con === false)) { > > return raiseError(DB_CONNECT_FAIL, null, null, > > null, $php_errormsg); > > } > > ini_restore('track_errors'); > > I agree that this is even more better then my approach. > > What chances about getting this into PEAR/DB ? > If nobody objects I can commit this change (and the other one of mysqlRaiseError) some time this weekend. Tomas V.V.Cox

« previous php.pear.dev (#220) next »