updated-packages
This commit is contained in:
@@ -3,19 +3,23 @@
|
||||
namespace Doctrine\DBAL\Driver;
|
||||
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Doctrine\DBAL\DBALException;
|
||||
use Doctrine\DBAL\Driver;
|
||||
use Doctrine\DBAL\Driver\DriverException as TheDriverException;
|
||||
use Doctrine\DBAL\Exception;
|
||||
use Doctrine\DBAL\Exception\DriverException;
|
||||
use Doctrine\DBAL\Platforms\SQLServer2005Platform;
|
||||
use Doctrine\DBAL\Platforms\SQLServer2008Platform;
|
||||
use Doctrine\DBAL\Platforms\SQLServer2012Platform;
|
||||
use Doctrine\DBAL\Platforms\SQLServerPlatform;
|
||||
use Doctrine\DBAL\Schema\SQLServerSchemaManager;
|
||||
use Doctrine\DBAL\VersionAwarePlatformDriver;
|
||||
|
||||
use function assert;
|
||||
use function preg_match;
|
||||
use function version_compare;
|
||||
|
||||
/**
|
||||
* Abstract base implementation of the {@link Doctrine\DBAL\Driver} interface for Microsoft SQL Server based drivers.
|
||||
* Abstract base implementation of the {@link Driver} interface for Microsoft SQL Server based drivers.
|
||||
*/
|
||||
abstract class AbstractSQLServerDriver implements Driver, VersionAwarePlatformDriver
|
||||
{
|
||||
@@ -24,12 +28,14 @@ abstract class AbstractSQLServerDriver implements Driver, VersionAwarePlatformDr
|
||||
*/
|
||||
public function createDatabasePlatformForVersion($version)
|
||||
{
|
||||
if (! preg_match(
|
||||
'/^(?P<major>\d+)(?:\.(?P<minor>\d+)(?:\.(?P<patch>\d+)(?:\.(?P<build>\d+))?)?)?/',
|
||||
$version,
|
||||
$versionParts
|
||||
)) {
|
||||
throw DBALException::invalidPlatformVersionSpecified(
|
||||
if (
|
||||
! preg_match(
|
||||
'/^(?P<major>\d+)(?:\.(?P<minor>\d+)(?:\.(?P<patch>\d+)(?:\.(?P<build>\d+))?)?)?/',
|
||||
$version,
|
||||
$versionParts
|
||||
)
|
||||
) {
|
||||
throw Exception::invalidPlatformVersionSpecified(
|
||||
$version,
|
||||
'<major_version>.<minor_version>.<patch_version>.<build_version>'
|
||||
);
|
||||
@@ -55,12 +61,22 @@ abstract class AbstractSQLServerDriver implements Driver, VersionAwarePlatformDr
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @deprecated Use Connection::getDatabase() instead.
|
||||
*/
|
||||
public function getDatabase(Connection $conn)
|
||||
{
|
||||
$params = $conn->getParams();
|
||||
|
||||
return $params['dbname'] ?? $conn->query('SELECT DB_NAME()')->fetchColumn();
|
||||
if (isset($params['dbname'])) {
|
||||
return $params['dbname'];
|
||||
}
|
||||
|
||||
$database = $conn->query('SELECT DB_NAME()')->fetchColumn();
|
||||
|
||||
assert($database !== false);
|
||||
|
||||
return $database;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,4 +94,14 @@ abstract class AbstractSQLServerDriver implements Driver, VersionAwarePlatformDr
|
||||
{
|
||||
return new SQLServerSchemaManager($conn);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $message
|
||||
*
|
||||
* @return DriverException
|
||||
*/
|
||||
public function convertException($message, TheDriverException $exception)
|
||||
{
|
||||
return new DriverException($message, $exception);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user