Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

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.

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 March 24, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Sep 01, 2011
Adding PDO::FETCH_COLUMN support to OCI8 fetchAll method using the fe…
…tch structure OCI_FETCHSTATEMENT_BY_COLUMN.
c343cc6
This page is out of date. Refresh to see the latest.
18  lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
@@ -36,7 +36,8 @@ class OCI8Statement implements \Doctrine\DBAL\Driver\Statement
36 36
     protected static $fetchStyleMap = array(
37 37
         PDO::FETCH_BOTH => OCI_BOTH,
38 38
         PDO::FETCH_ASSOC => OCI_ASSOC,
39  
-        PDO::FETCH_NUM => OCI_NUM
  39
+        PDO::FETCH_NUM => OCI_NUM,
  40
+        PDO::FETCH_COLUMN => OCI_NUM
40 41
     );
41 42
     protected $_paramMap = array();
42 43
 
@@ -193,11 +194,20 @@ public function fetchAll($fetchStyle = PDO::FETCH_BOTH)
193 194
         if ( ! isset(self::$fetchStyleMap[$fetchStyle])) {
194 195
             throw new \InvalidArgumentException("Invalid fetch style: " . $fetchStyle);
195 196
         }
196  
-        
  197
+      
  198
+        $fetchStructure = OCI_FETCHSTATEMENT_BY_ROW;
  199
+        if ($fetchStyle == PDO::FETCH_COLUMN) {
  200
+            $fetchStructure = OCI_FETCHSTATEMENT_BY_COLUMN;
  201
+        }
  202
+
197 203
         $result = array();
198 204
         oci_fetch_all($this->_sth, $result, 0, -1,
199  
-            self::$fetchStyleMap[$fetchStyle] | OCI_RETURN_NULLS | OCI_FETCHSTATEMENT_BY_ROW | OCI_RETURN_LOBS);
200  
-        
  205
+            self::$fetchStyleMap[$fetchStyle] | OCI_RETURN_NULLS | $fetchStructure | OCI_RETURN_LOBS);
  206
+
  207
+        if ($fetchStyle == PDO::FETCH_COLUMN) {
  208
+            $result = $result[0];
  209
+        }
  210
+
201 211
         return $result;
202 212
     }
203 213
 
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.