/** * Gets the number of affected rows by the last INSERT, UPDATE or DELETE query. * @return int number of rows * @throws Exception */ 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; }