Example #1
0
 public function fetch($fetchMode = null, $cursorOrientation = PDO::FETCH_ORI_NEXT, $cursorOffset = 0)
 {
     if (!$this->_cursorOpen) {
         return false;
     }
     return parent::fetch($fetchMode, $cursorOrientation, $cursorOffset);
 }
Example #2
0
 /**
  * Returns an array containing all of the result set rows.
  *
  * @param int $fetchMode Controls the contents of the returned array as
  *   documented in PDOStatement::fetch.
  * @param mixed $fetchArgument This argument has a different meaning
  *   depending on the value of the fetchMode parameter.
  * @param array $ctorArgs [optional] Arguments of custom class constructor
  *   when the fetch_style parameter is PDO::FETCH_CLASS.
  * @return array Array containing all of the remaining rows in the result
  *   set. The array represents each row as either an array of column values
  *   or an object with properties corresponding to each column name.
  */
 public function fetchAll($fetchMode = PDO::FETCH_BOTH, $fetchArgument = null, $ctorArgs = array())
 {
     $this->setFetchMode($fetchMode, $fetchArgument, $ctorArgs);
     $this->results = array();
     while ($row = $this->fetch()) {
         if (is_array($row) && is_resource(reset($row))) {
             $stmt = new Statement(reset($row), $this->connection, $this->options);
             $stmt->execute();
             $stmt->setFetchMode($fetchMode, $fetchArgument, $ctorArgs);
             while ($rs = $stmt->fetch()) {
                 $this->results[] = $rs;
             }
         } else {
             $this->results[] = $row;
         }
     }
     return $this->results;
 }