Commit c3626225 authored by Benjamin Eberlei's avatar Benjamin Eberlei

Merge branch 'DBAL-214' into 2.2

parents 5b284995 ba894a4d
...@@ -47,8 +47,12 @@ class ArrayStatement implements \IteratorAggregate, ResultStatement ...@@ -47,8 +47,12 @@ class ArrayStatement implements \IteratorAggregate, ResultStatement
return $this->columnCount; return $this->columnCount;
} }
public function setFetchMode($fetchStyle) public function setFetchMode($fetchStyle, $arg2 = null, $arg3 = null)
{ {
if ($arg2 !== null || $arg3 !== null) {
throw new \InvalidArgumentException("Caching layer does not support 2nd/3rd argument to setFetchMode()");
}
$this->defaultFetchStyle = $fetchStyle; $this->defaultFetchStyle = $fetchStyle;
} }
......
...@@ -132,7 +132,7 @@ class ResultCacheStatement implements \IteratorAggregate, ResultStatement ...@@ -132,7 +132,7 @@ class ResultCacheStatement implements \IteratorAggregate, ResultStatement
return $this->statement->columnCount(); return $this->statement->columnCount();
} }
public function setFetchMode($fetchStyle) public function setFetchMode($fetchStyle, $arg2 = null, $arg3 = null)
{ {
$this->defaultFetchStyle = $fetchStyle; $this->defaultFetchStyle = $fetchStyle;
} }
......
...@@ -189,7 +189,7 @@ class OCI8Statement implements \IteratorAggregate, Statement ...@@ -189,7 +189,7 @@ class OCI8Statement implements \IteratorAggregate, Statement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function setFetchMode($fetchStyle = PDO::FETCH_BOTH) public function setFetchMode($fetchStyle = PDO::FETCH_BOTH, $arg2 = null, $arg3 = null)
{ {
$this->_defaultFetchStyle = $fetchStyle; $this->_defaultFetchStyle = $fetchStyle;
} }
......
...@@ -31,12 +31,20 @@ class PDOStatement extends \PDOStatement implements Statement ...@@ -31,12 +31,20 @@ class PDOStatement extends \PDOStatement implements Statement
{ {
private function __construct() {} private function __construct() {}
public function setFetchMode($fetchStyle, $params = NULL) public function setFetchMode($fetchStyle, $arg2 = null, $arg3 = null)
{ {
// This thin wrapper is necessary to shield against the weird signature // This thin wrapper is necessary to shield against the weird signature
// of PDOStatement::setFetchMode(): even if the second and third // of PDOStatement::setFetchMode(): even if the second and third
// parameters are optional, PHP will not let us remove it from this // parameters are optional, PHP will not let us remove it from this
// declaration. // declaration.
if ($arg2 === null || $arg3 === null) {
return parent::setFetchMode($fetchStyle); return parent::setFetchMode($fetchStyle);
} }
if ($arg3 === null) {
return parent::setFetchMode($fetchStyle, $arg2);
}
return parent::setFetchMode($fetchStyle, $arg2, $arg3);
}
} }
...@@ -52,7 +52,7 @@ interface ResultStatement extends \Traversable ...@@ -52,7 +52,7 @@ interface ResultStatement extends \Traversable
* *
* @param integer $fetchStyle * @param integer $fetchStyle
*/ */
public function setFetchMode($fetchStyle); function setFetchMode($fetchStyle, $arg2 = null, $arg3 = null);
/** /**
* fetch * fetch
......
...@@ -101,9 +101,10 @@ class Statement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement ...@@ -101,9 +101,10 @@ class Statement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement
return $this->stmt->execute($params); return $this->stmt->execute($params);
} }
public function setFetchMode($fetchStyle) public function setFetchMode($fetchStyle, $arg1 = null, $arg2 = null)
{ {
$this->defaultFetchStyle = $fetchStyle; $this->defaultFetchStyle = $fetchStyle;
$this->stmt->setFetchMode($fetchStyle, $arg1, $arg2);
} }
public function getIterator() public function getIterator()
......
...@@ -177,9 +177,9 @@ class Statement implements \IteratorAggregate, DriverStatement ...@@ -177,9 +177,9 @@ class Statement implements \IteratorAggregate, DriverStatement
return $this->stmt->errorInfo(); return $this->stmt->errorInfo();
} }
public function setFetchMode($fetchStyle) public function setFetchMode($fetchStyle, $arg2 = null, $arg3 = null)
{ {
return $this->stmt->setFetchMode($fetchStyle); return $this->stmt->setFetchMode($fetchStyle, $arg2, $arg3);
} }
public function getIterator() public function getIterator()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment