Re: [db] Catching mysql_connect errors with set_error_handler ?
| From: | Markus Fischer | Date: | Fri, 13 Apr 2001 17:36:33 +0000 |
| Subject: | Re: [db] Catching mysql_connect errors with set_error_handler ? | ||
| References: | 1 2 3 4 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-219@lists.php.net to get a copy of this message | ||
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 ?
ty,
Markus
--
Markus Fischer, http://josefine.ben.tuwien.ac.at/~mfischer/
EMail: mfischer@josefine.ben.tuwien.ac.at
PGP Public Key: http://josefine.ben.tuwien.ac.at/~mfischer/C2272BD0.asc
PGP Fingerprint: D3B0 DD4F E12B F911 3CE1 C2B5 D674 B445 C227 2BD0