Example #1
0
 /**
  * Fetches the next row from the result set.
  * @param int $fetchMode Controls how rows will be returned.
  * @return mixed The next row from the result set.
  * @throws Exception
  */
 public function fetch($fetchMode = \PDO::FETCH_BOTH)
 {
     switch ($fetchMode) {
         case \PDO::FETCH_NUM:
             return $this->getPgsqlStatement()->fetchArray(null, PGSQL_NUM);
         case \PDO::FETCH_OBJ:
             return $this->getPgsqlStatement()->fetchObject();
         case \PDO::FETCH_ASSOC:
             return $this->getPgsqlStatement()->fetchAll();
         case \PDO::FETCH_BOTH:
             return $this->getPgsqlStatement()->fetchArray();
         default:
             throw Exception::fetchModeNotSupported($fetchMode);
     }
 }