/**
  * Gets the number of affected rows by the last INSERT, UPDATE or DELETE query.
  * @return int  number of rows
  * @throws DibiException
  */
 public function getAffectedRows()
 {
     $this->connected || $this->connect();
     $rows = $this->driver->getAffectedRows();
     if (!is_int($rows) || $rows < 0) {
         throw new DibiException('Cannot retrieve number of affected rows.');
     }
     return $rows;
 }