Skip to content
Permalink
Browse files

DboSource now check the actual status of connection by executing a du…

…mb query on DB

This change makes it possible for developer to build reconnection logic
on MySQL connections which frequently time out in long running CLI
processes.

Cherry picked onto 2.7 from #7190.
  • Loading branch information...
pbaire authored and markstory committed Aug 6, 2015
1 parent f959b76 commit a7b5f8c3af2398da3f6d0c35b4ac5bf77331468b
Showing with 6 additions and 0 deletions.
  1. +6 −0 lib/Cake/Model/Datasource/DboSource.php
@@ -857,6 +857,12 @@ public function name($data) {
* @return bool True if the database is connected, else false
*/
public function isConnected() {
try {
$connected = $this->_connection->query('SELECT 1');
} catch (Exception $e) {
$connected = false;
}
$this->connected = ! empty($connected);
return $this->connected;
}

0 comments on commit a7b5f8c

Please sign in to comment.
You can’t perform that action at this time.