Determining if Zend_DB_Adapter has connected to the database April 20, 2011Posted by Tournas Dimitrios in Zend Framework v1.10.
For logging and performance tracking we may want to find out if the current Zend_DB_Adapter has connected to the database . The Adapter class doesn’t have a method to return this information . You can create a subclass of the Adapter you need , and add a method such as the following:
public function isConnected()
Another solution if you use the PDO Adapter, is to enable its profiler and look for an entry for ‘connect’ in the resulting query profiles. Even though ‘connect’ isn’t really a statement, the PDO Adapter logs that operation with the query profiler. The non-PDO Adapters don’t do this yet, but there’s no reason why they shouldn’t .
This is the solution that I have found from the zend-framework community , if you have discovered a better solution , please post it on this blog .