Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'DBAL-339'

  • Loading branch information...
commit cddb50aaf9f90e7ce48368330b74804492a3ca4b 2 parents 24ec194 + b790619
Benjamin Eberlei authored September 05, 2012
6  lib/Doctrine/DBAL/Statement.php
@@ -190,6 +190,12 @@ public function errorInfo()
190 190
 
191 191
     public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null)
192 192
     {
  193
+        if ($arg2 === null) {
  194
+            return $this->stmt->setFetchMode($fetchMode);
  195
+        } else if ($arg3 === null) {
  196
+            return $this->stmt->setFetchMode($fetchMode, $arg2);
  197
+        }
  198
+
193 199
         return $this->stmt->setFetchMode($fetchMode, $arg2, $arg3);
194 200
     }
195 201
 
15  tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
@@ -501,6 +501,21 @@ public function testEmptyFetchColumnReturnsFalse()
501 501
         $this->assertFalse($this->_conn->query('SELECT test_int FROM fetch_table')->fetchColumn());
502 502
     }
503 503
 
  504
+    /**
  505
+     * @group DBAL-339
  506
+     */
  507
+    public function testSetFetchModeOnDbalStatement()
  508
+    {
  509
+        $sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?";
  510
+        $stmt = $this->_conn->executeQuery($sql, array(1, "foo"));
  511
+        $stmt->setFetchMode(\PDO::FETCH_NUM);
  512
+
  513
+        while ($row = $stmt->fetch()) {
  514
+            $this->assertTrue(isset($row[0]));
  515
+            $this->assertTrue(isset($row[1]));
  516
+        }
  517
+    }
  518
+
504 519
     private function setupFixture()
505 520
     {
506 521
         $this->_conn->executeQuery('DELETE FROM fetch_table')->execute();

0 notes on commit cddb50a

Please sign in to comment.
Something went wrong with that request. Please try again.