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
 /**
  * {@inheritDoc}
  */
 public function __construct($sth, Oci8 $connection = null, array $options = [])
 {
     if (is_object($sth) && $sth instanceof Statement) {
         list($sth, $connection, $options) = $this->_getParentProperties($sth, ['sth', 'connection', 'options']);
     }
     parent::__construct($sth, $connection, $options);
 }
 /**
  * Constructor
  *
  */
 public function __construct($sth, Oci8 $pdoOci8 = null, array $options = array())
 {
     if (is_object($sth) && $sth instanceof Statement) {
         parent::__construct($sth->_sth, $sth->_pdoOci8, $sth->_options);
     } else {
         parent::__construct($sth, $pdoOci8, $options);
     }
 }
Example #4
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;
 }
Example #5
0
 /**
  * Execute a PL/SQL Procedure and return its result.
  * Usage: DB::executeProcedure($procedureName, $bindings).
  * $bindings looks like:
  *         $bindings = [
  *                  'p_userid'  => $id
  *         ];
  *
  * @param string $procedureName
  * @param array $bindings
  * @param mixed $returnType
  * @return array
  */
 public function executeProcedure($procedureName, $bindings, $returnType = PDO::PARAM_STMT)
 {
     $command = sprintf('begin %s(:%s, :cursor); end;', $procedureName, implode(', :', array_keys($bindings)));
     $stmt = $this->getPdo()->prepare($command);
     foreach ($bindings as $bindingName => &$bindingValue) {
         $stmt->bindParam(':' . $bindingName, $bindingValue);
     }
     $cursor = null;
     $stmt->bindParam(':cursor', $cursor, $returnType);
     $stmt->execute();
     if ($returnType === PDO::PARAM_STMT) {
         $statement = new Statement($cursor, $this->getPdo(), $this->getPdo()->getOptions());
         $statement->execute();
         $results = $statement->fetchAll(PDO::FETCH_ASSOC);
         $statement->closeCursor();
         return $results;
     }
     return $cursor;
 }