Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add fetchAll(PDO::FETCH_COLUMN) support to OCI8 driver #52

Closed
wants to merge 1 commit into from

2 participants

Joe Heth Benjamin Eberlei
Joe Heth

Adding PDO::FETCH_COLUMN support to OCI8 fetchAll method using the fetch structure OCI_FETCHSTATEMENT_BY_COLUMN.

Joe Heth Adding PDO::FETCH_COLUMN support to OCI8 fetchAll method using the fe…
…tch structure OCI_FETCHSTATEMENT_BY_COLUMN.
c343cc6
Benjamin Eberlei
Owner

Fixed in http://www.doctrine-project.org/jira/browse/DBAL-241 - I badly merged your stuff, so the PR didnt get autoclosed.

Benjamin Eberlei beberlei closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 1, 2011
  1. Adding PDO::FETCH_COLUMN support to OCI8 fetchAll method using the fe…

    Joe Heth authored
    …tch structure OCI_FETCHSTATEMENT_BY_COLUMN.
This page is out of date. Refresh to see the latest.
Showing with 14 additions and 4 deletions.
  1. +14 −4 lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
18 lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
View
@@ -36,7 +36,8 @@ class OCI8Statement implements \Doctrine\DBAL\Driver\Statement
protected static $fetchStyleMap = array(
PDO::FETCH_BOTH => OCI_BOTH,
PDO::FETCH_ASSOC => OCI_ASSOC,
- PDO::FETCH_NUM => OCI_NUM
+ PDO::FETCH_NUM => OCI_NUM,
+ PDO::FETCH_COLUMN => OCI_NUM
);
protected $_paramMap = array();
@@ -193,11 +194,20 @@ public function fetchAll($fetchStyle = PDO::FETCH_BOTH)
if ( ! isset(self::$fetchStyleMap[$fetchStyle])) {
throw new \InvalidArgumentException("Invalid fetch style: " . $fetchStyle);
}
-
+
+ $fetchStructure = OCI_FETCHSTATEMENT_BY_ROW;
+ if ($fetchStyle == PDO::FETCH_COLUMN) {
+ $fetchStructure = OCI_FETCHSTATEMENT_BY_COLUMN;
+ }
+
$result = array();
oci_fetch_all($this->_sth, $result, 0, -1,
- self::$fetchStyleMap[$fetchStyle] | OCI_RETURN_NULLS | OCI_FETCHSTATEMENT_BY_ROW | OCI_RETURN_LOBS);
-
+ self::$fetchStyleMap[$fetchStyle] | OCI_RETURN_NULLS | $fetchStructure | OCI_RETURN_LOBS);
+
+ if ($fetchStyle == PDO::FETCH_COLUMN) {
+ $result = $result[0];
+ }
+
return $result;
}
Something went wrong with that request. Please try again.