Permalink
Browse files

Merge branch 'DBAL-339'

  • Loading branch information...
2 parents 24ec194 + b790619 commit cddb50aaf9f90e7ce48368330b74804492a3ca4b @beberlei beberlei committed Sep 5, 2012
Showing with 21 additions and 0 deletions.
  1. +6 −0 lib/Doctrine/DBAL/Statement.php
  2. +15 −0 tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
@@ -190,6 +190,12 @@ public function errorInfo()
public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null)
{
+ if ($arg2 === null) {
+ return $this->stmt->setFetchMode($fetchMode);
+ } else if ($arg3 === null) {
+ return $this->stmt->setFetchMode($fetchMode, $arg2);
+ }
+
return $this->stmt->setFetchMode($fetchMode, $arg2, $arg3);
}
@@ -501,6 +501,21 @@ public function testEmptyFetchColumnReturnsFalse()
$this->assertFalse($this->_conn->query('SELECT test_int FROM fetch_table')->fetchColumn());
}
+ /**
+ * @group DBAL-339
+ */
+ public function testSetFetchModeOnDbalStatement()
+ {
+ $sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?";
+ $stmt = $this->_conn->executeQuery($sql, array(1, "foo"));
+ $stmt->setFetchMode(\PDO::FETCH_NUM);
+
+ while ($row = $stmt->fetch()) {
+ $this->assertTrue(isset($row[0]));
+ $this->assertTrue(isset($row[1]));
+ }
+ }
+
private function setupFixture()
{
$this->_conn->executeQuery('DELETE FROM fetch_table')->execute();

0 comments on commit cddb50a

Please sign in to comment.