public function getAffectedRows() { $this->connected || $this->connect(); $rows = $this->driver->getAffectedRows(); if (!is_int($rows) || $rows < 0) { throw new Exception('Cannot retrieve number of affected rows.'); } return $rows; }