composer update
This commit is contained in:
@@ -1,21 +1,4 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver\SQLSrv;
|
||||
|
||||
@@ -31,7 +14,7 @@ class Driver extends AbstractSQLServerDriver
|
||||
*/
|
||||
public function connect(array $params, $username = null, $password = null, array $driverOptions = [])
|
||||
{
|
||||
if (!isset($params['host'])) {
|
||||
if (! isset($params['host'])) {
|
||||
throw new SQLSrvException("Missing 'host' in configuration for sqlsrv driver.");
|
||||
}
|
||||
|
||||
@@ -43,15 +26,20 @@ class Driver extends AbstractSQLServerDriver
|
||||
if (isset($params['dbname'])) {
|
||||
$driverOptions['Database'] = $params['dbname'];
|
||||
}
|
||||
|
||||
|
||||
if (isset($params['charset'])) {
|
||||
$driverOptions['CharacterSet'] = $params['charset'];
|
||||
}
|
||||
|
||||
$driverOptions['UID'] = $username;
|
||||
$driverOptions['PWD'] = $password;
|
||||
if ($username !== null) {
|
||||
$driverOptions['UID'] = $username;
|
||||
}
|
||||
|
||||
if (!isset($driverOptions['ReturnDatesAsStrings'])) {
|
||||
if ($password !== null) {
|
||||
$driverOptions['PWD'] = $password;
|
||||
}
|
||||
|
||||
if (! isset($driverOptions['ReturnDatesAsStrings'])) {
|
||||
$driverOptions['ReturnDatesAsStrings'] = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,35 +1,13 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver\SQLSrv;
|
||||
|
||||
/**
|
||||
* Last Id Data Container.
|
||||
*
|
||||
* @since 2.3
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
class LastInsertId
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
/** @var int */
|
||||
private $id;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,21 +1,4 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver\SQLSrv;
|
||||
|
||||
@@ -40,36 +23,29 @@ use function str_replace;
|
||||
|
||||
/**
|
||||
* SQL Server implementation for the Connection interface.
|
||||
*
|
||||
* @since 2.3
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
class SQLSrvConnection implements Connection, ServerInfoAwareConnection
|
||||
{
|
||||
/**
|
||||
* @var resource
|
||||
*/
|
||||
/** @var resource */
|
||||
protected $conn;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Driver\SQLSrv\LastInsertId
|
||||
*/
|
||||
/** @var LastInsertId */
|
||||
protected $lastInsertId;
|
||||
|
||||
/**
|
||||
* @param string $serverName
|
||||
* @param array $connectionOptions
|
||||
* @param string $serverName
|
||||
* @param mixed[] $connectionOptions
|
||||
*
|
||||
* @throws \Doctrine\DBAL\Driver\SQLSrv\SQLSrvException
|
||||
* @throws SQLSrvException
|
||||
*/
|
||||
public function __construct($serverName, $connectionOptions)
|
||||
{
|
||||
if ( ! sqlsrv_configure('WarningsReturnAsErrors', 0)) {
|
||||
if (! sqlsrv_configure('WarningsReturnAsErrors', 0)) {
|
||||
throw SQLSrvException::fromSqlSrvErrors();
|
||||
}
|
||||
|
||||
$this->conn = sqlsrv_connect($serverName, $connectionOptions);
|
||||
if ( ! $this->conn) {
|
||||
if (! $this->conn) {
|
||||
throw SQLSrvException::fromSqlSrvErrors();
|
||||
}
|
||||
$this->lastInsertId = new LastInsertId();
|
||||
@@ -107,7 +83,7 @@ class SQLSrvConnection implements Connection, ServerInfoAwareConnection
|
||||
public function query()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$sql = $args[0];
|
||||
$sql = $args[0];
|
||||
$stmt = $this->prepare($sql);
|
||||
$stmt->execute();
|
||||
|
||||
@@ -116,7 +92,6 @@ class SQLSrvConnection implements Connection, ServerInfoAwareConnection
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @license New BSD, code from Zend Framework
|
||||
*/
|
||||
public function quote($value, $type = ParameterType::STRING)
|
||||
{
|
||||
@@ -136,7 +111,7 @@ class SQLSrvConnection implements Connection, ServerInfoAwareConnection
|
||||
{
|
||||
$stmt = sqlsrv_query($this->conn, $statement);
|
||||
|
||||
if (false === $stmt) {
|
||||
if ($stmt === false) {
|
||||
throw SQLSrvException::fromSqlSrvErrors();
|
||||
}
|
||||
|
||||
@@ -163,7 +138,7 @@ class SQLSrvConnection implements Connection, ServerInfoAwareConnection
|
||||
*/
|
||||
public function beginTransaction()
|
||||
{
|
||||
if ( ! sqlsrv_begin_transaction($this->conn)) {
|
||||
if (! sqlsrv_begin_transaction($this->conn)) {
|
||||
throw SQLSrvException::fromSqlSrvErrors();
|
||||
}
|
||||
}
|
||||
@@ -173,7 +148,7 @@ class SQLSrvConnection implements Connection, ServerInfoAwareConnection
|
||||
*/
|
||||
public function commit()
|
||||
{
|
||||
if ( ! sqlsrv_commit($this->conn)) {
|
||||
if (! sqlsrv_commit($this->conn)) {
|
||||
throw SQLSrvException::fromSqlSrvErrors();
|
||||
}
|
||||
}
|
||||
@@ -183,7 +158,7 @@ class SQLSrvConnection implements Connection, ServerInfoAwareConnection
|
||||
*/
|
||||
public function rollBack()
|
||||
{
|
||||
if ( ! sqlsrv_rollback($this->conn)) {
|
||||
if (! sqlsrv_rollback($this->conn)) {
|
||||
throw SQLSrvException::fromSqlSrvErrors();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,7 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver\SQLSrv;
|
||||
|
||||
|
||||
use Doctrine\DBAL\Driver\AbstractDriverException;
|
||||
use const SQLSRV_ERR_ERRORS;
|
||||
use function rtrim;
|
||||
@@ -34,24 +16,26 @@ class SQLSrvException extends AbstractDriverException
|
||||
*/
|
||||
public static function fromSqlSrvErrors()
|
||||
{
|
||||
$errors = sqlsrv_errors(SQLSRV_ERR_ERRORS);
|
||||
$message = "";
|
||||
$sqlState = null;
|
||||
$errors = sqlsrv_errors(SQLSRV_ERR_ERRORS);
|
||||
$message = '';
|
||||
$sqlState = null;
|
||||
$errorCode = null;
|
||||
|
||||
foreach ($errors as $error) {
|
||||
$message .= "SQLSTATE [".$error['SQLSTATE'].", ".$error['code']."]: ". $error['message']."\n";
|
||||
$message .= 'SQLSTATE [' . $error['SQLSTATE'] . ', ' . $error['code'] . ']: ' . $error['message'] . "\n";
|
||||
|
||||
if (null === $sqlState) {
|
||||
if ($sqlState === null) {
|
||||
$sqlState = $error['SQLSTATE'];
|
||||
}
|
||||
|
||||
if (null === $errorCode) {
|
||||
$errorCode = $error['code'];
|
||||
if ($errorCode !== null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$errorCode = $error['code'];
|
||||
}
|
||||
if ( ! $message) {
|
||||
$message = "SQL Server error occurred but no error message was retrieved from driver.";
|
||||
if (! $message) {
|
||||
$message = 'SQL Server error occurred but no error message was retrieved from driver.';
|
||||
}
|
||||
|
||||
return new self(rtrim($message), $sqlState, $errorCode);
|
||||
|
||||
@@ -1,29 +1,13 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver\SQLSrv;
|
||||
|
||||
use Doctrine\DBAL\Driver\Statement;
|
||||
use Doctrine\DBAL\Driver\StatementIterator;
|
||||
use Doctrine\DBAL\FetchMode;
|
||||
use Doctrine\DBAL\ParameterType;
|
||||
use IteratorAggregate;
|
||||
use Doctrine\DBAL\Driver\Statement;
|
||||
use PDO;
|
||||
use const SQLSRV_ENC_BINARY;
|
||||
use const SQLSRV_ERR_ERRORS;
|
||||
use const SQLSRV_FETCH_ASSOC;
|
||||
@@ -52,9 +36,6 @@ use function stripos;
|
||||
|
||||
/**
|
||||
* SQL Server Statement.
|
||||
*
|
||||
* @since 2.3
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
class SQLSrvStatement implements IteratorAggregate, Statement
|
||||
{
|
||||
@@ -82,21 +63,21 @@ class SQLSrvStatement implements IteratorAggregate, Statement
|
||||
/**
|
||||
* References to the variables bound as statement parameters.
|
||||
*
|
||||
* @var array
|
||||
* @var mixed
|
||||
*/
|
||||
private $variables = [];
|
||||
|
||||
/**
|
||||
* Bound parameter types.
|
||||
*
|
||||
* @var array
|
||||
* @var int[]
|
||||
*/
|
||||
private $types = [];
|
||||
|
||||
/**
|
||||
* Translations.
|
||||
*
|
||||
* @var array
|
||||
* @var int[]
|
||||
*/
|
||||
private static $fetchMap = [
|
||||
FetchMode::MIXED => SQLSRV_FETCH_BOTH,
|
||||
@@ -128,7 +109,7 @@ class SQLSrvStatement implements IteratorAggregate, Statement
|
||||
/**
|
||||
* The last insert ID.
|
||||
*
|
||||
* @var \Doctrine\DBAL\Driver\SQLSrv\LastInsertId|null
|
||||
* @var LastInsertId|null
|
||||
*/
|
||||
private $lastInsertId;
|
||||
|
||||
@@ -141,25 +122,24 @@ class SQLSrvStatement implements IteratorAggregate, Statement
|
||||
|
||||
/**
|
||||
* Append to any INSERT query to retrieve the last insert id.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const LAST_INSERT_ID_SQL = ';SELECT SCOPE_IDENTITY() AS LastInsertId;';
|
||||
public const LAST_INSERT_ID_SQL = ';SELECT SCOPE_IDENTITY() AS LastInsertId;';
|
||||
|
||||
/**
|
||||
* @param resource $conn
|
||||
* @param string $sql
|
||||
* @param \Doctrine\DBAL\Driver\SQLSrv\LastInsertId|null $lastInsertId
|
||||
* @param resource $conn
|
||||
* @param string $sql
|
||||
*/
|
||||
public function __construct($conn, $sql, LastInsertId $lastInsertId = null)
|
||||
public function __construct($conn, $sql, ?LastInsertId $lastInsertId = null)
|
||||
{
|
||||
$this->conn = $conn;
|
||||
$this->sql = $sql;
|
||||
$this->sql = $sql;
|
||||
|
||||
if (stripos($sql, 'INSERT INTO ') === 0) {
|
||||
$this->sql .= self::LAST_INSERT_ID_SQL;
|
||||
$this->lastInsertId = $lastInsertId;
|
||||
if (stripos($sql, 'INSERT INTO ') !== 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->sql .= self::LAST_INSERT_ID_SQL;
|
||||
$this->lastInsertId = $lastInsertId;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -167,14 +147,14 @@ class SQLSrvStatement implements IteratorAggregate, Statement
|
||||
*/
|
||||
public function bindValue($param, $value, $type = ParameterType::STRING)
|
||||
{
|
||||
if (!is_numeric($param)) {
|
||||
if (! is_numeric($param)) {
|
||||
throw new SQLSrvException(
|
||||
'sqlsrv does not support named parameters to queries, use question mark (?) placeholders instead.'
|
||||
);
|
||||
}
|
||||
|
||||
$this->variables[$param] = $value;
|
||||
$this->types[$param] = $type;
|
||||
$this->types[$param] = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -182,12 +162,12 @@ class SQLSrvStatement implements IteratorAggregate, Statement
|
||||
*/
|
||||
public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null)
|
||||
{
|
||||
if (!is_numeric($column)) {
|
||||
throw new SQLSrvException("sqlsrv does not support named parameters to queries, use question mark (?) placeholders instead.");
|
||||
if (! is_numeric($column)) {
|
||||
throw new SQLSrvException('sqlsrv does not support named parameters to queries, use question mark (?) placeholders instead.');
|
||||
}
|
||||
|
||||
$this->variables[$column] =& $variable;
|
||||
$this->types[$column] = $type;
|
||||
$this->types[$column] = $type;
|
||||
|
||||
// unset the statement resource if it exists as the new one will need to be bound to the new variable
|
||||
$this->stmt = null;
|
||||
@@ -199,7 +179,7 @@ class SQLSrvStatement implements IteratorAggregate, Statement
|
||||
public function closeCursor()
|
||||
{
|
||||
// not having the result means there's nothing to close
|
||||
if (!$this->result) {
|
||||
if (! $this->result) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -207,7 +187,8 @@ class SQLSrvStatement implements IteratorAggregate, Statement
|
||||
// @link http://php.net/manual/en/pdostatement.closecursor.php
|
||||
// @link https://github.com/php/php-src/blob/php-7.0.11/ext/pdo/pdo_stmt.c#L2075
|
||||
// deliberately do not consider multiple result sets, since doctrine/dbal doesn't support them
|
||||
while (sqlsrv_fetch($this->stmt));
|
||||
while (sqlsrv_fetch($this->stmt)) {
|
||||
}
|
||||
|
||||
$this->result = false;
|
||||
|
||||
@@ -251,16 +232,16 @@ class SQLSrvStatement implements IteratorAggregate, Statement
|
||||
if ($params) {
|
||||
$hasZeroIndex = array_key_exists(0, $params);
|
||||
foreach ($params as $key => $val) {
|
||||
$key = ($hasZeroIndex && is_numeric($key)) ? $key + 1 : $key;
|
||||
$key = $hasZeroIndex && is_numeric($key) ? $key + 1 : $key;
|
||||
$this->bindValue($key, $val);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $this->stmt) {
|
||||
if (! $this->stmt) {
|
||||
$this->stmt = $this->prepare();
|
||||
}
|
||||
|
||||
if (!sqlsrv_execute($this->stmt)) {
|
||||
if (! sqlsrv_execute($this->stmt)) {
|
||||
throw SQLSrvException::fromSqlSrvErrors();
|
||||
}
|
||||
|
||||
@@ -277,6 +258,7 @@ class SQLSrvStatement implements IteratorAggregate, Statement
|
||||
* Prepares SQL Server statement resource
|
||||
*
|
||||
* @return resource
|
||||
*
|
||||
* @throws SQLSrvException
|
||||
*/
|
||||
private function prepare()
|
||||
@@ -310,7 +292,7 @@ class SQLSrvStatement implements IteratorAggregate, Statement
|
||||
|
||||
$stmt = sqlsrv_prepare($this->conn, $this->sql, $params);
|
||||
|
||||
if (!$stmt) {
|
||||
if (! $stmt) {
|
||||
throw SQLSrvException::fromSqlSrvErrors();
|
||||
}
|
||||
|
||||
@@ -342,11 +324,11 @@ class SQLSrvStatement implements IteratorAggregate, Statement
|
||||
*
|
||||
* @throws SQLSrvException
|
||||
*/
|
||||
public function fetch($fetchMode = null, $cursorOrientation = \PDO::FETCH_ORI_NEXT, $cursorOffset = 0)
|
||||
public function fetch($fetchMode = null, $cursorOrientation = PDO::FETCH_ORI_NEXT, $cursorOffset = 0)
|
||||
{
|
||||
// do not try fetching from the statement if it's not expected to contain result
|
||||
// in order to prevent exceptional situation
|
||||
if (!$this->result) {
|
||||
if (! $this->result) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -412,7 +394,7 @@ class SQLSrvStatement implements IteratorAggregate, Statement
|
||||
{
|
||||
$row = $this->fetch(FetchMode::NUMERIC);
|
||||
|
||||
if (false === $row) {
|
||||
if ($row === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user