本文整理汇总了PHP中Doctrine\DBAL\DBALException::invalidPlatformVersionSpecified方法的典型用法代码示例。如果您正苦于以下问题:PHP DBALException::invalidPlatformVersionSpecified方法的具体用法?PHP DBALException::invalidPlatformVersionSpecified怎么用?PHP DBALException::invalidPlatformVersionSpecified使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\DBAL\DBALException
的用法示例。
在下文中一共展示了DBALException::invalidPlatformVersionSpecified方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createDatabasePlatformForVersion
/**
* {@inheritdoc}
*/
public function createDatabasePlatformForVersion($version)
{
if (!preg_match('/^(?P<major>\\d+)(?:\\.(?P<minor>\\d+)(?:\\.(?P<patch>\\d+))?)?/', $version, $versionParts)) {
throw DBALException::invalidPlatformVersionSpecified($version, '<major_version>.<minor_version>.<patch_version>');
}
$majorVersion = $versionParts['major'];
$minorVersion = isset($versionParts['minor']) ? $versionParts['minor'] : 0;
$patchVersion = isset($versionParts['patch']) ? $versionParts['patch'] : 0;
$version = $majorVersion . '.' . $minorVersion . '.' . $patchVersion;
switch (true) {
case version_compare($version, '9.2', '>='):
return new PostgreSQL92Platform();
case version_compare($version, '9.1', '>='):
return new PostgreSQL91Platform();
default:
return new PostgreSqlPlatform();
}
}
示例2: createDatabasePlatformForVersion
/**
* {@inheritdoc}
*/
public function createDatabasePlatformForVersion($version)
{
if (!preg_match('/^(?P<major>\\d+)(?:\\.(?P<minor>\\d+)(?:\\.(?P<patch>\\d+)(?:\\.(?P<build>\\d+))?)?)?/', $version, $versionParts)) {
throw DBALException::invalidPlatformVersionSpecified($version, '<major_version>.<minor_version>.<patch_version>.<build_version>');
}
$majorVersion = $versionParts['major'];
$minorVersion = isset($versionParts['minor']) ? $versionParts['minor'] : 0;
$patchVersion = isset($versionParts['patch']) ? $versionParts['patch'] : 0;
$buildVersion = isset($versionParts['build']) ? $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();
}
}
示例3: createDatabasePlatformForVersion
/**
* {@inheritdoc}
*/
public function createDatabasePlatformForVersion($version)
{
if (!preg_match('/^(?P<major>\\d+)(?:\\.(?P<minor>\\d+)(?:\\.(?P<patch>\\d+))?)?/', $version, $versionParts)) {
throw DBALException::invalidPlatformVersionSpecified($version, '<major_version>.<minor_version>.<patch_version>');
}
if (false !== stripos($version, 'mariadb')) {
return $this->getDatabasePlatform();
}
$majorVersion = $versionParts['major'];
$minorVersion = isset($versionParts['minor']) ? $versionParts['minor'] : 0;
$patchVersion = isset($versionParts['patch']) ? $versionParts['patch'] : 0;
$version = $majorVersion . '.' . $minorVersion . '.' . $patchVersion;
if (version_compare($version, '5.7', '>=')) {
return new MySQL57Platform();
}
return $this->getDatabasePlatform();
}
示例4: createDatabasePlatformForVersion
/**
* {@inheritdoc}
*
* @see http://www-01.ibm.com/support/knowledgecenter/SSGU8G_11.50.0/com.ibm.sqls.doc/ids_sqs_1491.htm
*/
public function createDatabasePlatformForVersion($version)
{
$regex = '/^(?P<server_type>.*)
(?i:\\s+Version\\s+)
(?P<major>\\d+)\\.
(?P<minor>\\d+)\\.
(?P<so>F|H|T|U)
(?P<level>[[:alnum:]]+)/x';
if (!preg_match($regex, $version, $versionParts)) {
throw DBALException::invalidPlatformVersionSpecified($version, '<server_type> Version <major>.<minor><os><level>');
}
// Right now only exists one platform for all versions
return $this->getDatabasePlatform();
}