\d+)(?:\.(?P\d+)(?:\.(?P\d+)(?:\.(?P\d+))?)?)?/', $version, $versionParts )) { throw DBALException::invalidPlatformVersionSpecified( $version, '...' ); } $majorVersion = $versionParts['major']; $minorVersion = $versionParts['minor'] ?? 0; $patchVersion = $versionParts['patch'] ?? 0; $buildVersion = $versionParts['build'] ?? 0; $version = $majorVersion . '.' . $minorVersion . '.' . $patchVersion . '.' . $buildVersion; switch (true) { case version_compare($version, '11.00.2100', '>='): return new SQLServer2012Platform(); case version_compare($version, '10.00.1600', '>='): return new SQLServer2008Platform(); case version_compare($version, '9.00.1399', '>='): return new SQLServer2005Platform(); default: return new SQLServerPlatform(); } } /** * {@inheritdoc} */ public function getDatabase(Connection $conn) { $params = $conn->getParams(); return $params['dbname'] ?? $conn->query('SELECT DB_NAME()')->fetchColumn(); } /** * {@inheritdoc} */ public function getDatabasePlatform() { return new SQLServer2008Platform(); } /** * {@inheritdoc} */ public function getSchemaManager(Connection $conn) { return new SQLServerSchemaManager($conn); } }