[db] Catching mysql_connect errors with set_error_handler ?

From: Date: Thu, 12 Apr 2001 19:56:26 +0000
Subject: [db] Catching mysql_connect errors with set_error_handler ?
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-212@lists.php.net to get a copy of this message
Hello, While writing an application for accessing different databases using PEAR/DB, I noticed that I was not able to catch the exact error when I e.g. used the wrong socket path for the connection. When using a wrong username or some other wrong information, the feedback from pear/db is only 'DB Error: connect failed'. While pear/db reports only 'DB Error: connect failed' you can, using set_error_handler before calling mysql_connect, catch the exact error like : MySQL Connection Failed: Unknown MySQL Server Host 'localhostf' or MySQL Connection Failed: Can't connect to local MySQL server through socket '/var/ruqld/mysqld.sock' or MySQL Connection Failed: Access denied for user: 'rooter@localhost' or MySQL Connection Failed: Can't connect to MySQL server on '127.0.0.1' I'm not deeply involved in pear coding and its standards, but can there be seen a possibility to implement this ? Currently I can't verify if this is the same for other database but I won't exclude it. thanks, 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

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