Unverified Commit 94b6980f authored by Sergei Morozov's avatar Sergei Morozov

Merge pull request #3486 from morozov/conn-stmt-void

Converted Connection and Statement methods which returned false in case of a failure into void
parents fcde5f5f a64a4c76
# Upgrade to 3.0 # Upgrade to 3.0
## BC BREAK `Statement` and `Connection` methods return `void`.
`Connection::connect()`, `Statement::bindParam()`, `::bindValue()`, `::execute()`, `ResultStatement::setFetchMode()` and `::closeCursor()` no longer return a boolean value. They will throw an exception in case of failure.
## BC BREAK `Statement::rowCount()` is moved. ## BC BREAK `Statement::rowCount()` is moved.
`Statement::rowCount()` has been moved to the `ResultStatement` interface where it belongs by definition. `Statement::rowCount()` has been moved to the `ResultStatement` interface where it belongs by definition.
......
...@@ -44,7 +44,7 @@ class ArrayStatement implements IteratorAggregate, ResultStatement ...@@ -44,7 +44,7 @@ class ArrayStatement implements IteratorAggregate, ResultStatement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function closeCursor() public function closeCursor() : void
{ {
unset($this->data); unset($this->data);
} }
...@@ -72,15 +72,13 @@ class ArrayStatement implements IteratorAggregate, ResultStatement ...@@ -72,15 +72,13 @@ class ArrayStatement implements IteratorAggregate, ResultStatement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function setFetchMode($fetchMode, ...$args) public function setFetchMode($fetchMode, ...$args) : void
{ {
if (count($args) > 0) { if (count($args) > 0) {
throw new InvalidArgumentException('Caching layer does not support 2nd/3rd argument to setFetchMode()'); throw new InvalidArgumentException('Caching layer does not support 2nd/3rd argument to setFetchMode()');
} }
$this->defaultFetchMode = $fetchMode; $this->defaultFetchMode = $fetchMode;
return true;
} }
/** /**
......
...@@ -75,11 +75,12 @@ class ResultCacheStatement implements IteratorAggregate, ResultStatement ...@@ -75,11 +75,12 @@ class ResultCacheStatement implements IteratorAggregate, ResultStatement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function closeCursor() public function closeCursor() : void
{ {
$this->statement->closeCursor(); $this->statement->closeCursor();
if (! $this->emptied || $this->data === null) { if (! $this->emptied || $this->data === null) {
return true; return;
} }
$data = $this->resultCache->fetch($this->cacheKey); $data = $this->resultCache->fetch($this->cacheKey);
...@@ -90,8 +91,6 @@ class ResultCacheStatement implements IteratorAggregate, ResultStatement ...@@ -90,8 +91,6 @@ class ResultCacheStatement implements IteratorAggregate, ResultStatement
$this->resultCache->save($this->cacheKey, $data, $this->lifetime); $this->resultCache->save($this->cacheKey, $data, $this->lifetime);
unset($this->data); unset($this->data);
return true;
} }
/** /**
...@@ -105,11 +104,9 @@ class ResultCacheStatement implements IteratorAggregate, ResultStatement ...@@ -105,11 +104,9 @@ class ResultCacheStatement implements IteratorAggregate, ResultStatement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function setFetchMode($fetchMode, ...$args) public function setFetchMode($fetchMode, ...$args) : void
{ {
$this->defaultFetchMode = $fetchMode; $this->defaultFetchMode = $fetchMode;
return true;
} }
/** /**
......
...@@ -346,13 +346,12 @@ class Connection implements DriverConnection ...@@ -346,13 +346,12 @@ class Connection implements DriverConnection
/** /**
* Establishes the connection with the database. * Establishes the connection with the database.
* *
* @return bool TRUE if the connection was successfully established, FALSE if * @throws DriverException
* the connection is already open.
*/ */
public function connect() public function connect() : void
{ {
if ($this->isConnected) { if ($this->isConnected) {
return false; return;
} }
$driverOptions = $this->params['driverOptions'] ?? []; $driverOptions = $this->params['driverOptions'] ?? [];
...@@ -368,12 +367,12 @@ class Connection implements DriverConnection ...@@ -368,12 +367,12 @@ class Connection implements DriverConnection
$this->beginTransaction(); $this->beginTransaction();
} }
if ($this->_eventManager->hasListeners(Events::postConnect)) { if (! $this->_eventManager->hasListeners(Events::postConnect)) {
$eventArgs = new Event\ConnectionEventArgs($this); return;
$this->_eventManager->dispatchEvent(Events::postConnect, $eventArgs);
} }
return true; $eventArgs = new Event\ConnectionEventArgs($this);
$this->_eventManager->dispatchEvent(Events::postConnect, $eventArgs);
} }
/** /**
...@@ -527,10 +526,8 @@ class Connection implements DriverConnection ...@@ -527,10 +526,8 @@ class Connection implements DriverConnection
* Sets the fetch mode. * Sets the fetch mode.
* *
* @param int $fetchMode * @param int $fetchMode
*
* @return void
*/ */
public function setFetchMode($fetchMode) public function setFetchMode($fetchMode) : void
{ {
$this->defaultFetchMode = $fetchMode; $this->defaultFetchMode = $fetchMode;
} }
......
...@@ -123,7 +123,7 @@ class MasterSlaveConnection extends Connection ...@@ -123,7 +123,7 @@ class MasterSlaveConnection extends Connection
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function connect($connectionName = null) public function connect($connectionName = null) : void
{ {
$requestedConnectionChange = ($connectionName !== null); $requestedConnectionChange = ($connectionName !== null);
$connectionName = $connectionName ?: 'slave'; $connectionName = $connectionName ?: 'slave';
...@@ -136,7 +136,7 @@ class MasterSlaveConnection extends Connection ...@@ -136,7 +136,7 @@ class MasterSlaveConnection extends Connection
// change request, then abort right here, because we are already done. // change request, then abort right here, because we are already done.
// This prevents writes to the slave in case of "keepSlave" option enabled. // This prevents writes to the slave in case of "keepSlave" option enabled.
if ($this->_conn !== null && ! $requestedConnectionChange) { if ($this->_conn !== null && ! $requestedConnectionChange) {
return false; return;
} }
$forceMasterAsSlave = false; $forceMasterAsSlave = false;
...@@ -153,7 +153,7 @@ class MasterSlaveConnection extends Connection ...@@ -153,7 +153,7 @@ class MasterSlaveConnection extends Connection
$this->connections['slave'] = $this->_conn; $this->connections['slave'] = $this->_conn;
} }
return false; return;
} }
if ($connectionName === 'master') { if ($connectionName === 'master') {
...@@ -167,12 +167,12 @@ class MasterSlaveConnection extends Connection ...@@ -167,12 +167,12 @@ class MasterSlaveConnection extends Connection
$this->connections['slave'] = $this->_conn = $this->connectTo($connectionName); $this->connections['slave'] = $this->_conn = $this->connectTo($connectionName);
} }
if ($this->_eventManager->hasListeners(Events::postConnect)) { if (! $this->_eventManager->hasListeners(Events::postConnect)) {
$eventArgs = new ConnectionEventArgs($this); return;
$this->_eventManager->dispatchEvent(Events::postConnect, $eventArgs);
} }
return true; $eventArgs = new ConnectionEventArgs($this);
$this->_eventManager->dispatchEvent(Events::postConnect, $eventArgs);
} }
/** /**
......
...@@ -89,15 +89,15 @@ class DB2Statement implements IteratorAggregate, Statement ...@@ -89,15 +89,15 @@ class DB2Statement implements IteratorAggregate, Statement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function bindValue($param, $value, $type = ParameterType::STRING) public function bindValue($param, $value, $type = ParameterType::STRING) : void
{ {
return $this->bindParam($param, $value, $type); $this->bindParam($param, $value, $type);
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null) public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null) : void
{ {
switch ($type) { switch ($type) {
case ParameterType::INTEGER: case ParameterType::INTEGER:
...@@ -122,8 +122,6 @@ class DB2Statement implements IteratorAggregate, Statement ...@@ -122,8 +122,6 @@ class DB2Statement implements IteratorAggregate, Statement
$this->bind($column, $variable, DB2_PARAM_IN, DB2_CHAR); $this->bind($column, $variable, DB2_PARAM_IN, DB2_CHAR);
break; break;
} }
return true;
} }
/** /**
...@@ -144,17 +142,17 @@ class DB2Statement implements IteratorAggregate, Statement ...@@ -144,17 +142,17 @@ class DB2Statement implements IteratorAggregate, Statement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function closeCursor() public function closeCursor() : void
{ {
$this->bindParam = []; $this->bindParam = [];
if (! db2_free_result($this->stmt)) { if (! $this->result) {
return false; return;
} }
$this->result = false; db2_free_result($this->stmt);
return true; $this->result = false;
} }
/** /**
...@@ -187,7 +185,7 @@ class DB2Statement implements IteratorAggregate, Statement ...@@ -187,7 +185,7 @@ class DB2Statement implements IteratorAggregate, Statement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function execute($params = null) public function execute($params = null) : void
{ {
if ($params === null) { if ($params === null) {
ksort($this->bindParam); ksort($this->bindParam);
...@@ -222,14 +220,12 @@ class DB2Statement implements IteratorAggregate, Statement ...@@ -222,14 +220,12 @@ class DB2Statement implements IteratorAggregate, Statement
} }
$this->result = true; $this->result = true;
return $retval;
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function setFetchMode($fetchMode, ...$args) public function setFetchMode($fetchMode, ...$args) : void
{ {
$this->defaultFetchMode = $fetchMode; $this->defaultFetchMode = $fetchMode;
...@@ -237,11 +233,11 @@ class DB2Statement implements IteratorAggregate, Statement ...@@ -237,11 +233,11 @@ class DB2Statement implements IteratorAggregate, Statement
$this->defaultFetchClass = $args[0]; $this->defaultFetchClass = $args[0];
} }
if (isset($args[1])) { if (! isset($args[1])) {
$this->defaultFetchClassCtorArgs = (array) $args[2]; return;
} }
return true; $this->defaultFetchClassCtorArgs = (array) $args[2];
} }
/** /**
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace Doctrine\DBAL\Driver\Mysqli; namespace Doctrine\DBAL\Driver\Mysqli;
use Doctrine\DBAL\DBALException; use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver\DriverException;
use Doctrine\DBAL\Driver\Statement; use Doctrine\DBAL\Driver\Statement;
use Doctrine\DBAL\Driver\StatementIterator; use Doctrine\DBAL\Driver\StatementIterator;
use Doctrine\DBAL\Exception\InvalidArgumentException; use Doctrine\DBAL\Exception\InvalidArgumentException;
...@@ -101,7 +102,7 @@ class MysqliStatement implements IteratorAggregate, Statement ...@@ -101,7 +102,7 @@ class MysqliStatement implements IteratorAggregate, Statement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null) public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null) : void
{ {
assert(is_int($column)); assert(is_int($column));
...@@ -111,14 +112,12 @@ class MysqliStatement implements IteratorAggregate, Statement ...@@ -111,14 +112,12 @@ class MysqliStatement implements IteratorAggregate, Statement
$this->_bindedValues[$column] =& $variable; $this->_bindedValues[$column] =& $variable;
$this->types[$column - 1] = self::$_paramTypeMap[$type]; $this->types[$column - 1] = self::$_paramTypeMap[$type];
return true;
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function bindValue($param, $value, $type = ParameterType::STRING) public function bindValue($param, $value, $type = ParameterType::STRING) : void
{ {
assert(is_int($param)); assert(is_int($param));
...@@ -129,14 +128,12 @@ class MysqliStatement implements IteratorAggregate, Statement ...@@ -129,14 +128,12 @@ class MysqliStatement implements IteratorAggregate, Statement
$this->_values[$param] = $value; $this->_values[$param] = $value;
$this->_bindedValues[$param] =& $this->_values[$param]; $this->_bindedValues[$param] =& $this->_values[$param];
$this->types[$param - 1] = self::$_paramTypeMap[$type]; $this->types[$param - 1] = self::$_paramTypeMap[$type];
return true;
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function execute($params = null) public function execute($params = null) : void
{ {
if ($params !== null && count($params) > 0) { if ($params !== null && count($params) > 0) {
if (! $this->bindUntypedValues($params)) { if (! $this->bindUntypedValues($params)) {
...@@ -199,12 +196,12 @@ class MysqliStatement implements IteratorAggregate, Statement ...@@ -199,12 +196,12 @@ class MysqliStatement implements IteratorAggregate, Statement
} }
$this->result = true; $this->result = true;
return true;
} }
/** /**
* Binds parameters with known types previously bound to the statement * Binds parameters with known types previously bound to the statement
*
* @throws DriverException
*/ */
private function bindTypedParameters() private function bindTypedParameters()
{ {
...@@ -408,12 +405,10 @@ class MysqliStatement implements IteratorAggregate, Statement ...@@ -408,12 +405,10 @@ class MysqliStatement implements IteratorAggregate, Statement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function closeCursor() public function closeCursor() : void
{ {
$this->_stmt->free_result(); $this->_stmt->free_result();
$this->result = false; $this->result = false;
return true;
} }
/** /**
...@@ -439,11 +434,9 @@ class MysqliStatement implements IteratorAggregate, Statement ...@@ -439,11 +434,9 @@ class MysqliStatement implements IteratorAggregate, Statement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function setFetchMode($fetchMode, ...$args) public function setFetchMode($fetchMode, ...$args) : void
{ {
$this->_defaultFetchMode = $fetchMode; $this->_defaultFetchMode = $fetchMode;
return true;
} }
/** /**
......
...@@ -268,15 +268,15 @@ class OCI8Statement implements IteratorAggregate, Statement ...@@ -268,15 +268,15 @@ class OCI8Statement implements IteratorAggregate, Statement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function bindValue($param, $value, $type = ParameterType::STRING) public function bindValue($param, $value, $type = ParameterType::STRING) : void
{ {
return $this->bindParam($param, $value, $type, null); $this->bindParam($param, $value, $type, null);
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null) public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null) : void
{ {
$column = $this->_paramMap[$column]; $column = $this->_paramMap[$column];
...@@ -293,13 +293,15 @@ class OCI8Statement implements IteratorAggregate, Statement ...@@ -293,13 +293,15 @@ class OCI8Statement implements IteratorAggregate, Statement
$this->boundValues[$column] =& $variable; $this->boundValues[$column] =& $variable;
return oci_bind_by_name( if (! oci_bind_by_name(
$this->_sth, $this->_sth,
$column, $column,
$variable, $variable,
$length ?? -1, $length ?? -1,
$this->convertParameterType($type) $this->convertParameterType($type)
); )) {
throw OCI8Exception::fromErrorInfo($this->errorInfo());
}
} }
/** /**
...@@ -322,18 +324,16 @@ class OCI8Statement implements IteratorAggregate, Statement ...@@ -322,18 +324,16 @@ class OCI8Statement implements IteratorAggregate, Statement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function closeCursor() public function closeCursor() : void
{ {
// not having the result means there's nothing to close // not having the result means there's nothing to close
if (! $this->result) { if (! $this->result) {
return true; return;
} }
oci_cancel($this->_sth); oci_cancel($this->_sth);
$this->result = false; $this->result = false;
return true;
} }
/** /**
...@@ -374,7 +374,7 @@ class OCI8Statement implements IteratorAggregate, Statement ...@@ -374,7 +374,7 @@ class OCI8Statement implements IteratorAggregate, Statement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function execute($params = null) public function execute($params = null) : void
{ {
if ($params) { if ($params) {
$hasZeroIndex = array_key_exists(0, $params); $hasZeroIndex = array_key_exists(0, $params);
...@@ -386,9 +386,7 @@ class OCI8Statement implements IteratorAggregate, Statement ...@@ -386,9 +386,7 @@ class OCI8Statement implements IteratorAggregate, Statement
$param = $key; $param = $key;
} }
if (! $this->bindValue($param, $val)) { $this->bindValue($param, $val);
throw OCI8Exception::fromErrorInfo($this->errorInfo());
}
} }
} }
...@@ -398,18 +396,14 @@ class OCI8Statement implements IteratorAggregate, Statement ...@@ -398,18 +396,14 @@ class OCI8Statement implements IteratorAggregate, Statement
} }
$this->result = true; $this->result = true;
return $ret;
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function setFetchMode($fetchMode, ...$args) public function setFetchMode($fetchMode, ...$args) : void
{ {
$this->_defaultFetchMode = $fetchMode; $this->_defaultFetchMode = $fetchMode;
return true;
} }
/** /**
......
...@@ -14,7 +14,7 @@ class Statement extends PDOStatement ...@@ -14,7 +14,7 @@ class Statement extends PDOStatement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null, $driverOptions = null) public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null, $driverOptions = null) : void
{ {
if (($type === ParameterType::LARGE_OBJECT || $type === ParameterType::BINARY) if (($type === ParameterType::LARGE_OBJECT || $type === ParameterType::BINARY)
&& $driverOptions === null && $driverOptions === null
...@@ -22,14 +22,14 @@ class Statement extends PDOStatement ...@@ -22,14 +22,14 @@ class Statement extends PDOStatement
$driverOptions = PDO::SQLSRV_ENCODING_BINARY; $driverOptions = PDO::SQLSRV_ENCODING_BINARY;
} }
return parent::bindParam($column, $variable, $type, $length, $driverOptions); parent::bindParam($column, $variable, $type, $length, $driverOptions);
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function bindValue($param, $value, $type = ParameterType::STRING) public function bindValue($param, $value, $type = ParameterType::STRING) : void
{ {
return $this->bindParam($param, $value, $type); $this->bindParam($param, $value, $type);
} }
} }
...@@ -50,12 +50,12 @@ class PDOStatement implements IteratorAggregate, Statement ...@@ -50,12 +50,12 @@ class PDOStatement implements IteratorAggregate, Statement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function setFetchMode($fetchMode, ...$args) public function setFetchMode($fetchMode, ...$args) : void
{ {
$fetchMode = $this->convertFetchMode($fetchMode); $fetchMode = $this->convertFetchMode($fetchMode);
try { try {
return $this->stmt->setFetchMode($fetchMode, ...$args); $this->stmt->setFetchMode($fetchMode, ...$args);
} catch (\PDOException $exception) { } catch (\PDOException $exception) {
throw new PDOException($exception); throw new PDOException($exception);
} }
...@@ -64,12 +64,12 @@ class PDOStatement implements IteratorAggregate, Statement ...@@ -64,12 +64,12 @@ class PDOStatement implements IteratorAggregate, Statement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function bindValue($param, $value, $type = ParameterType::STRING) public function bindValue($param, $value, $type = ParameterType::STRING) : void
{ {
$type = $this->convertParamType($type); $type = $this->convertParamType($type);
try { try {
return $this->stmt->bindValue($param, $value, $type); $this->stmt->bindValue($param, $value, $type);
} catch (\PDOException $exception) { } catch (\PDOException $exception) {
throw new PDOException($exception); throw new PDOException($exception);
} }
...@@ -78,12 +78,12 @@ class PDOStatement implements IteratorAggregate, Statement ...@@ -78,12 +78,12 @@ class PDOStatement implements IteratorAggregate, Statement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null, $driverOptions = null) public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null, $driverOptions = null) : void
{ {
$type = $this->convertParamType($type); $type = $this->convertParamType($type);
try { try {
return $this->stmt->bindParam($column, $variable, $type, ...array_slice(func_get_args(), 3)); $this->stmt->bindParam($column, $variable, $type, ...array_slice(func_get_args(), 3));
} catch (\PDOException $exception) { } catch (\PDOException $exception) {
throw new PDOException($exception); throw new PDOException($exception);
} }
...@@ -92,15 +92,9 @@ class PDOStatement implements IteratorAggregate, Statement ...@@ -92,15 +92,9 @@ class PDOStatement implements IteratorAggregate, Statement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function closeCursor() public function closeCursor() : void
{ {
try { $this->stmt->closeCursor();
return $this->stmt->closeCursor();
} catch (\PDOException $exception) {
// Exceptions not allowed by the interface.
// In case driver implementations do not adhere to the interface, silence exceptions here.
return true;
}
} }
/** /**
...@@ -130,10 +124,10 @@ class PDOStatement implements IteratorAggregate, Statement ...@@ -130,10 +124,10 @@ class PDOStatement implements IteratorAggregate, Statement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function execute($params = null) public function execute($params = null) : void
{ {
try { try {
return $this->stmt->execute($params); $this->stmt->execute($params);
} catch (\PDOException $exception) { } catch (\PDOException $exception) {
throw new PDOException($exception); throw new PDOException($exception);
} }
......
...@@ -11,10 +11,8 @@ interface ResultStatement extends Traversable ...@@ -11,10 +11,8 @@ interface ResultStatement extends Traversable
{ {
/** /**
* Closes the cursor, enabling the statement to be executed again. * Closes the cursor, enabling the statement to be executed again.
*
* @return bool TRUE on success or FALSE on failure.
*/ */
public function closeCursor(); public function closeCursor() : void;
/** /**
* Returns the number of columns in the result set * Returns the number of columns in the result set
...@@ -42,10 +40,8 @@ interface ResultStatement extends Traversable ...@@ -42,10 +40,8 @@ interface ResultStatement extends Traversable
* @param int $fetchMode Controls how the next row will be returned to the caller. * @param int $fetchMode Controls how the next row will be returned to the caller.
* The value must be one of the {@link \Doctrine\DBAL\FetchMode} constants. * The value must be one of the {@link \Doctrine\DBAL\FetchMode} constants.
* @param mixed ...$args Optional mode-specific arguments (see {@link self::fetchAll()}). * @param mixed ...$args Optional mode-specific arguments (see {@link self::fetchAll()}).
*
* @return bool
*/ */
public function setFetchMode($fetchMode, ...$args); public function setFetchMode($fetchMode, ...$args) : void;
/** /**
* Returns the next row of a result set. * Returns the next row of a result set.
......
...@@ -89,7 +89,7 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement ...@@ -89,7 +89,7 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement
* *
* @throws SQLAnywhereException * @throws SQLAnywhereException
*/ */
public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null) public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null) : void
{ {
switch ($type) { switch ($type) {
case ParameterType::INTEGER: case ParameterType::INTEGER:
...@@ -116,30 +116,22 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement ...@@ -116,30 +116,22 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement
if (! sasql_stmt_bind_param_ex($this->stmt, $column - 1, $variable, $type, $variable === null)) { if (! sasql_stmt_bind_param_ex($this->stmt, $column - 1, $variable, $type, $variable === null)) {
throw SQLAnywhereException::fromSQLAnywhereError($this->conn, $this->stmt); throw SQLAnywhereException::fromSQLAnywhereError($this->conn, $this->stmt);
} }
return true;
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function bindValue($param, $value, $type = ParameterType::STRING) public function bindValue($param, $value, $type = ParameterType::STRING) : void
{ {
return $this->bindParam($param, $value, $type); $this->bindParam($param, $value, $type);
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*
* @throws SQLAnywhereException
*/ */
public function closeCursor() public function closeCursor() : void
{ {
if (! sasql_stmt_reset($this->stmt)) { sasql_stmt_reset($this->stmt);
throw SQLAnywhereException::fromSQLAnywhereError($this->conn, $this->stmt);
}
return true;
} }
/** /**
...@@ -171,7 +163,7 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement ...@@ -171,7 +163,7 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement
* *
* @throws SQLAnywhereException * @throws SQLAnywhereException
*/ */
public function execute($params = null) public function execute($params = null) : void
{ {
if (is_array($params)) { if (is_array($params)) {
$hasZeroIndex = array_key_exists(0, $params); $hasZeroIndex = array_key_exists(0, $params);
...@@ -190,8 +182,6 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement ...@@ -190,8 +182,6 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement
} }
$this->result = sasql_stmt_result_metadata($this->stmt); $this->result = sasql_stmt_result_metadata($this->stmt);
return true;
} }
/** /**
...@@ -309,7 +299,7 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement ...@@ -309,7 +299,7 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function setFetchMode($fetchMode, ...$args) public function setFetchMode($fetchMode, ...$args) : void
{ {
$this->defaultFetchMode = $fetchMode; $this->defaultFetchMode = $fetchMode;
...@@ -317,11 +307,11 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement ...@@ -317,11 +307,11 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement
$this->defaultFetchClass = $args[0]; $this->defaultFetchClass = $args[0];
} }
if (isset($args[1])) { if (! isset($args[1])) {
$this->defaultFetchClassCtorArgs = (array) $args[1]; return;
} }
return true; $this->defaultFetchClassCtorArgs = (array) $args[1];
} }
/** /**
......
...@@ -147,7 +147,7 @@ class SQLSrvStatement implements IteratorAggregate, Statement ...@@ -147,7 +147,7 @@ class SQLSrvStatement implements IteratorAggregate, Statement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function bindValue($param, $value, $type = ParameterType::STRING) public function bindValue($param, $value, $type = ParameterType::STRING) : void
{ {
if (! is_numeric($param)) { if (! is_numeric($param)) {
throw new SQLSrvException( throw new SQLSrvException(
...@@ -162,7 +162,7 @@ class SQLSrvStatement implements IteratorAggregate, Statement ...@@ -162,7 +162,7 @@ class SQLSrvStatement implements IteratorAggregate, Statement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null) public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null) : void
{ {
if (! is_numeric($column)) { if (! is_numeric($column)) {
throw new SQLSrvException('sqlsrv does not support named parameters to queries, use question mark (?) placeholders instead.'); throw new SQLSrvException('sqlsrv does not support named parameters to queries, use question mark (?) placeholders instead.');
...@@ -178,11 +178,11 @@ class SQLSrvStatement implements IteratorAggregate, Statement ...@@ -178,11 +178,11 @@ class SQLSrvStatement implements IteratorAggregate, Statement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function closeCursor() public function closeCursor() : void
{ {
// not having the result means there's nothing to close // not having the result means there's nothing to close
if ($this->stmt === null || ! $this->result) { if ($this->stmt === null || ! $this->result) {
return true; return;
} }
// emulate it by fetching and discarding rows, similarly to what PDO does in this case // emulate it by fetching and discarding rows, similarly to what PDO does in this case
...@@ -193,8 +193,6 @@ class SQLSrvStatement implements IteratorAggregate, Statement ...@@ -193,8 +193,6 @@ class SQLSrvStatement implements IteratorAggregate, Statement
} }
$this->result = false; $this->result = false;
return true;
} }
/** /**
...@@ -233,7 +231,7 @@ class SQLSrvStatement implements IteratorAggregate, Statement ...@@ -233,7 +231,7 @@ class SQLSrvStatement implements IteratorAggregate, Statement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function execute($params = null) public function execute($params = null) : void
{ {
if ($params) { if ($params) {
$hasZeroIndex = array_key_exists(0, $params); $hasZeroIndex = array_key_exists(0, $params);
...@@ -312,7 +310,7 @@ class SQLSrvStatement implements IteratorAggregate, Statement ...@@ -312,7 +310,7 @@ class SQLSrvStatement implements IteratorAggregate, Statement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function setFetchMode($fetchMode, ...$args) public function setFetchMode($fetchMode, ...$args) : void
{ {
$this->defaultFetchMode = $fetchMode; $this->defaultFetchMode = $fetchMode;
...@@ -320,11 +318,11 @@ class SQLSrvStatement implements IteratorAggregate, Statement ...@@ -320,11 +318,11 @@ class SQLSrvStatement implements IteratorAggregate, Statement
$this->defaultFetchClass = $args[0]; $this->defaultFetchClass = $args[0];
} }
if (isset($args[1])) { if (! isset($args[1])) {
$this->defaultFetchClassCtorArgs = (array) $args[1]; return;
} }
return true; $this->defaultFetchClassCtorArgs = (array) $args[1];
} }
/** /**
......
...@@ -26,9 +26,9 @@ interface Statement extends ResultStatement ...@@ -26,9 +26,9 @@ interface Statement extends ResultStatement
* @param int $type Explicit data type for the parameter using the {@link \Doctrine\DBAL\ParameterType} * @param int $type Explicit data type for the parameter using the {@link \Doctrine\DBAL\ParameterType}
* constants. * constants.
* *
* @return bool TRUE on success or FALSE on failure. * @throws DriverException
*/ */
public function bindValue($param, $value, $type = ParameterType::STRING); public function bindValue($param, $value, $type = ParameterType::STRING) : void;
/** /**
* Binds a PHP variable to a corresponding named (not supported by mysqli driver, see comment below) or question * Binds a PHP variable to a corresponding named (not supported by mysqli driver, see comment below) or question
...@@ -53,9 +53,9 @@ interface Statement extends ResultStatement ...@@ -53,9 +53,9 @@ interface Statement extends ResultStatement
* @param int|null $length You must specify maxlength when using an OUT bind * @param int|null $length You must specify maxlength when using an OUT bind
* so that PHP allocates enough memory to hold the returned value. * so that PHP allocates enough memory to hold the returned value.
* *
* @return bool TRUE on success or FALSE on failure. * @throws DriverException
*/ */
public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null); public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null) : void;
/** /**
* Fetches the SQLSTATE associated with the last operation on the statement handle. * Fetches the SQLSTATE associated with the last operation on the statement handle.
...@@ -85,7 +85,7 @@ interface Statement extends ResultStatement ...@@ -85,7 +85,7 @@ interface Statement extends ResultStatement
* @param mixed[]|null $params An array of values with as many elements as there are * @param mixed[]|null $params An array of values with as many elements as there are
* bound parameters in the SQL statement being executed. * bound parameters in the SQL statement being executed.
* *
* @return bool TRUE on success or FALSE on failure. * @throws DriverException
*/ */
public function execute($params = null); public function execute($params = null) : void;
} }
...@@ -39,11 +39,16 @@ class Connection extends \Doctrine\DBAL\Connection ...@@ -39,11 +39,16 @@ class Connection extends \Doctrine\DBAL\Connection
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function connect() public function connect() : void
{ {
$ret = parent::connect(); if ($this->isConnected()) {
if ($ret) { return;
}
parent::connect();
$params = $this->getParams(); $params = $this->getParams();
if (isset($params['portability'])) { if (isset($params['portability'])) {
if ($this->getDatabasePlatform()->getName() === 'oracle') { if ($this->getDatabasePlatform()->getName() === 'oracle') {
$params['portability'] &= self::PORTABILITY_ORACLE; $params['portability'] &= self::PORTABILITY_ORACLE;
...@@ -63,7 +68,10 @@ class Connection extends \Doctrine\DBAL\Connection ...@@ -63,7 +68,10 @@ class Connection extends \Doctrine\DBAL\Connection
$this->portability = $params['portability']; $this->portability = $params['portability'];
} }
if (isset($params['fetch_case']) && $this->portability & self::PORTABILITY_FIX_CASE) { if (! isset($params['fetch_case']) || ! ($this->portability & self::PORTABILITY_FIX_CASE)) {
return;
}
if ($this->_conn instanceof PDOConnection) { if ($this->_conn instanceof PDOConnection) {
// make use of c-level support for case handling // make use of c-level support for case handling
$this->_conn->getWrappedConnection()->setAttribute(PDO::ATTR_CASE, $params['fetch_case']); $this->_conn->getWrappedConnection()->setAttribute(PDO::ATTR_CASE, $params['fetch_case']);
...@@ -71,10 +79,6 @@ class Connection extends \Doctrine\DBAL\Connection ...@@ -71,10 +79,6 @@ class Connection extends \Doctrine\DBAL\Connection
$this->case = $params['fetch_case'] === ColumnCase::LOWER ? CASE_LOWER : CASE_UPPER; $this->case = $params['fetch_case'] === ColumnCase::LOWER ? CASE_LOWER : CASE_UPPER;
} }
} }
}
return $ret;
}
/** /**
* @return int * @return int
......
...@@ -45,29 +45,29 @@ class Statement implements IteratorAggregate, DriverStatement ...@@ -45,29 +45,29 @@ class Statement implements IteratorAggregate, DriverStatement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null) public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null) : void
{ {
assert($this->stmt instanceof DriverStatement); assert($this->stmt instanceof DriverStatement);
return $this->stmt->bindParam($column, $variable, $type, $length); $this->stmt->bindParam($column, $variable, $type, $length);
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function bindValue($param, $value, $type = ParameterType::STRING) public function bindValue($param, $value, $type = ParameterType::STRING) : void
{ {
assert($this->stmt instanceof DriverStatement); assert($this->stmt instanceof DriverStatement);
return $this->stmt->bindValue($param, $value, $type); $this->stmt->bindValue($param, $value, $type);
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function closeCursor() public function closeCursor() : void
{ {
return $this->stmt->closeCursor(); $this->stmt->closeCursor();
} }
/** /**
...@@ -101,21 +101,21 @@ class Statement implements IteratorAggregate, DriverStatement ...@@ -101,21 +101,21 @@ class Statement implements IteratorAggregate, DriverStatement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function execute($params = null) public function execute($params = null) : void
{ {
assert($this->stmt instanceof DriverStatement); assert($this->stmt instanceof DriverStatement);
return $this->stmt->execute($params); $this->stmt->execute($params);
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function setFetchMode($fetchMode, ...$args) public function setFetchMode($fetchMode, ...$args) : void
{ {
$this->defaultFetchMode = $fetchMode; $this->defaultFetchMode = $fetchMode;
return $this->stmt->setFetchMode($fetchMode, ...$args); $this->stmt->setFetchMode($fetchMode, ...$args);
} }
/** /**
......
...@@ -166,18 +166,16 @@ class PoolingShardConnection extends Connection ...@@ -166,18 +166,16 @@ class PoolingShardConnection extends Connection
* *
* @param string|int|null $shardId * @param string|int|null $shardId
* *
* @return bool
*
* @throws ShardingException * @throws ShardingException
*/ */
public function connect($shardId = null) public function connect($shardId = null) : void
{ {
if ($shardId === null && $this->_conn) { if ($shardId === null && $this->_conn) {
return false; return;
} }
if ($shardId !== null && $shardId === $this->activeShardId) { if ($shardId !== null && $shardId === $this->activeShardId) {
return false; return;
} }
if ($this->getTransactionNestingLevel() > 0) { if ($this->getTransactionNestingLevel() > 0) {
...@@ -189,17 +187,17 @@ class PoolingShardConnection extends Connection ...@@ -189,17 +187,17 @@ class PoolingShardConnection extends Connection
if (isset($this->activeConnections[$activeShardId])) { if (isset($this->activeConnections[$activeShardId])) {
$this->_conn = $this->activeConnections[$activeShardId]; $this->_conn = $this->activeConnections[$activeShardId];
return false; return;
} }
$this->_conn = $this->activeConnections[$activeShardId] = $this->connectTo($activeShardId); $this->_conn = $this->activeConnections[$activeShardId] = $this->connectTo($activeShardId);
if ($this->_eventManager->hasListeners(Events::postConnect)) { if (! $this->_eventManager->hasListeners(Events::postConnect)) {
$eventArgs = new ConnectionEventArgs($this); return;
$this->_eventManager->dispatchEvent(Events::postConnect, $eventArgs);
} }
return true; $eventArgs = new ConnectionEventArgs($this);
$this->_eventManager->dispatchEvent(Events::postConnect, $eventArgs);
} }
/** /**
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace Doctrine\DBAL; namespace Doctrine\DBAL;
use Doctrine\DBAL\Driver\DriverException;
use Doctrine\DBAL\Driver\Statement as DriverStatement; use Doctrine\DBAL\Driver\Statement as DriverStatement;
use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Type;
...@@ -84,16 +85,18 @@ class Statement implements IteratorAggregate, DriverStatement ...@@ -84,16 +85,18 @@ class Statement implements IteratorAggregate, DriverStatement
* @param mixed $value The value of the parameter. * @param mixed $value The value of the parameter.
* @param mixed $type Either a PDO binding type or a DBAL mapping type name or instance. * @param mixed $type Either a PDO binding type or a DBAL mapping type name or instance.
* *
* @return bool TRUE on success, FALSE on failure. * @throws DBALException
* @throws DriverException
*/ */
public function bindValue($name, $value, $type = ParameterType::STRING) public function bindValue($name, $value, $type = ParameterType::STRING) : void
{ {
$this->params[$name] = $value; $this->params[$name] = $value;
$this->types[$name] = $type; $this->types[$name] = $type;
if ($type !== null) {
if (is_string($type)) { if (is_string($type)) {
$type = Type::getType($type); $type = Type::getType($type);
} }
if ($type instanceof Type) { if ($type instanceof Type) {
$value = $type->convertToDatabaseValue($value, $this->platform); $value = $type->convertToDatabaseValue($value, $this->platform);
$bindingType = $type->getBindingType(); $bindingType = $type->getBindingType();
...@@ -101,10 +104,7 @@ class Statement implements IteratorAggregate, DriverStatement ...@@ -101,10 +104,7 @@ class Statement implements IteratorAggregate, DriverStatement
$bindingType = $type; $bindingType = $type;
} }
return $this->stmt->bindValue($name, $value, $bindingType); $this->stmt->bindValue($name, $value, $bindingType);
}
return $this->stmt->bindValue($name, $value);
} }
/** /**
...@@ -118,26 +118,22 @@ class Statement implements IteratorAggregate, DriverStatement ...@@ -118,26 +118,22 @@ class Statement implements IteratorAggregate, DriverStatement
* @param int|null $length Must be specified when using an OUT bind * @param int|null $length Must be specified when using an OUT bind
* so that PHP allocates enough memory to hold the returned value. * so that PHP allocates enough memory to hold the returned value.
* *
* @return bool TRUE on success, FALSE on failure. * @throws DriverException
*/ */
public function bindParam($name, &$var, $type = ParameterType::STRING, $length = null) public function bindParam($name, &$var, $type = ParameterType::STRING, $length = null) : void
{ {
$this->params[$name] = $var; $this->params[$name] = $var;
$this->types[$name] = $type; $this->types[$name] = $type;
return $this->stmt->bindParam($name, $var, $type, $length); $this->stmt->bindParam($name, $var, $type, $length);
} }
/** /**
* Executes the statement with the currently bound parameters. * {@inheritDoc}
*
* @param mixed[]|null $params
*
* @return bool TRUE on success, FALSE on failure.
* *
* @throws DBALException * @throws DBALException
*/ */
public function execute($params = null) public function execute($params = null) : void
{ {
if (is_array($params)) { if (is_array($params)) {
$this->params = $params; $this->params = $params;
...@@ -147,32 +143,28 @@ class Statement implements IteratorAggregate, DriverStatement ...@@ -147,32 +143,28 @@ class Statement implements IteratorAggregate, DriverStatement
$logger->startQuery($this->sql, $this->params, $this->types); $logger->startQuery($this->sql, $this->params, $this->types);
try { try {
$stmt = $this->stmt->execute($params); $this->stmt->execute($params);
} catch (Throwable $ex) { } catch (Throwable $ex) {
$logger->stopQuery();
throw DBALException::driverExceptionDuringQuery( throw DBALException::driverExceptionDuringQuery(
$this->conn->getDriver(), $this->conn->getDriver(),
$ex, $ex,
$this->sql, $this->sql,
$this->conn->resolveParams($this->params, $this->types) $this->conn->resolveParams($this->params, $this->types)
); );
} finally {
$logger->stopQuery();
} }
$logger->stopQuery();
$this->params = []; $this->params = [];
$this->types = []; $this->types = [];
return $stmt;
} }
/** /**
* Closes the cursor, freeing the database resources used by this statement. * {@inheritDoc}
*
* @return bool TRUE on success, FALSE on failure.
*/ */
public function closeCursor() public function closeCursor() : void
{ {
return $this->stmt->closeCursor(); $this->stmt->closeCursor();
} }
/** /**
...@@ -206,9 +198,9 @@ class Statement implements IteratorAggregate, DriverStatement ...@@ -206,9 +198,9 @@ class Statement implements IteratorAggregate, DriverStatement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function setFetchMode($fetchMode, ...$args) public function setFetchMode($fetchMode, ...$args) : void
{ {
return $this->stmt->setFetchMode($fetchMode, ...$args); $this->stmt->setFetchMode($fetchMode, ...$args);
} }
/** /**
......
...@@ -316,7 +316,9 @@ class ConnectionTest extends DbalFunctionalTestCase ...@@ -316,7 +316,9 @@ class ConnectionTest extends DbalFunctionalTestCase
$this->connection->getEventManager() $this->connection->getEventManager()
); );
self::assertTrue($connection->connect()); $connection->connect();
self::assertTrue($connection->isConnected());
$connection->close(); $connection->close();
} }
......
...@@ -241,8 +241,11 @@ EOF ...@@ -241,8 +241,11 @@ EOF
public function testCloseCursorOnNonExecutedStatement() : void public function testCloseCursorOnNonExecutedStatement() : void
{ {
$this->expectNotToPerformAssertions();
$stmt = $this->connection->prepare('SELECT id FROM stmt_test'); $stmt = $this->connection->prepare('SELECT id FROM stmt_test');
self::assertTrue($stmt->closeCursor());
$stmt->closeCursor();
} }
/** /**
...@@ -250,12 +253,23 @@ EOF ...@@ -250,12 +253,23 @@ EOF
*/ */
public function testCloseCursorAfterCursorEnd() : void public function testCloseCursorAfterCursorEnd() : void
{ {
$this->expectNotToPerformAssertions();
$stmt = $this->connection->prepare('SELECT name FROM stmt_test'); $stmt = $this->connection->prepare('SELECT name FROM stmt_test');
$stmt->execute(); $stmt->execute();
$stmt->fetch(); $stmt->fetch();
self::assertTrue($stmt->closeCursor()); $stmt->closeCursor();
}
public function testCloseCursorAfterClosingCursor() : void
{
$this->expectNotToPerformAssertions();
$stmt = $this->connection->executeQuery('SELECT name FROM stmt_test');
$stmt->closeCursor();
$stmt->closeCursor();
} }
/** /**
......
...@@ -45,10 +45,9 @@ class StatementTest extends DbalTestCase ...@@ -45,10 +45,9 @@ class StatementTest extends DbalTestCase
$this->wrappedStmt->expects($this->once()) $this->wrappedStmt->expects($this->once())
->method('bindParam') ->method('bindParam')
->with($column, $variable, $type, $length) ->with($column, $variable, $type, $length);
->will($this->returnValue(true));
self::assertTrue($this->stmt->bindParam($column, $variable, $type, $length)); $this->stmt->bindParam($column, $variable, $type, $length);
} }
public function testBindValue() : void public function testBindValue() : void
...@@ -59,19 +58,17 @@ class StatementTest extends DbalTestCase ...@@ -59,19 +58,17 @@ class StatementTest extends DbalTestCase
$this->wrappedStmt->expects($this->once()) $this->wrappedStmt->expects($this->once())
->method('bindValue') ->method('bindValue')
->with($param, $value, $type) ->with($param, $value, $type);
->will($this->returnValue(true));
self::assertTrue($this->stmt->bindValue($param, $value, $type)); $this->stmt->bindValue($param, $value, $type);
} }
public function testCloseCursor() : void public function testCloseCursor() : void
{ {
$this->wrappedStmt->expects($this->once()) $this->wrappedStmt->expects($this->once())
->method('closeCursor') ->method('closeCursor');
->will($this->returnValue(true));
self::assertTrue($this->stmt->closeCursor()); $this->stmt->closeCursor();
} }
public function testColumnCount() : void public function testColumnCount() : void
...@@ -116,10 +113,9 @@ class StatementTest extends DbalTestCase ...@@ -116,10 +113,9 @@ class StatementTest extends DbalTestCase
$this->wrappedStmt->expects($this->once()) $this->wrappedStmt->expects($this->once())
->method('execute') ->method('execute')
->with($params) ->with($params);
->will($this->returnValue(true));
self::assertTrue($this->stmt->execute($params)); $this->stmt->execute($params);
} }
public function testSetFetchMode() : void public function testSetFetchMode() : void
...@@ -137,7 +133,7 @@ class StatementTest extends DbalTestCase ...@@ -137,7 +133,7 @@ class StatementTest extends DbalTestCase
$re->setAccessible(true); $re->setAccessible(true);
self::assertSame(FetchMode::MIXED, $re->getValue($this->stmt)); self::assertSame(FetchMode::MIXED, $re->getValue($this->stmt));
self::assertTrue($this->stmt->setFetchMode($fetchMode, $arg1, $arg2)); $this->stmt->setFetchMode($fetchMode, $arg1, $arg2);
self::assertSame($fetchMode, $re->getValue($this->stmt)); self::assertSame($fetchMode, $re->getValue($this->stmt));
} }
......
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