/** * Called by the constructor */ protected function prepare() { // since PDO can emulate prepared statement, prepare() do not always // communicate with the database, and therefore do not trigger automatic // reconnection. Instead we manually check if the connection is alive. if (!$this->dbh->ping()) { $this->dbh->autoreconnect(); } $this->pdo_statement = $this->dbh->__call('prepare', array($this->statement, $this->driver_options)); }