‪TYPO3CMS  9.5
PlatformInformation.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
3 
5 
6 /*
7  * This file is part of the TYPO3 CMS project.
8  *
9  * It is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License, either version 2
11  * of the License, or any later version.
12  *
13  * For the full copyright and license information, please read the
14  * LICENSE.txt file that was distributed with this source code.
15  *
16  * The TYPO3 project - inspiring people to share!
17  */
18 
19 use Doctrine\DBAL\Platforms\AbstractPlatform;
20 use Doctrine\DBAL\Platforms\MySqlPlatform;
21 use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
22 use Doctrine\DBAL\Platforms\SqlitePlatform;
23 use Doctrine\DBAL\Platforms\SQLServerPlatform;
24 
31 {
35  protected static ‪$identifierLimits = [
36  'mysql' => 63,
37  'postgresql' => 63,
38  'sqlserver' => 128,
39  'sqlite' => 1024, // arbitrary limit, SQLite is only limited by the total statement length
40  ];
41 
45  protected static ‪$bindParameterLimits = [
46  'mysql' => 65535,
47  'postgresql' => 34464,
48  'sqlserver' => 2100,
49  'sqlite' => 999,
50  ];
51 
59  public static function ‪getMaxIdentifierLength(AbstractPlatform $platform): int
60  {
61  $platformName = static::getPlatformIdentifier($platform);
62 
63  return self::$identifierLimits[$platformName];
64  }
65 
73  public static function ‪getMaxBindParameters(AbstractPlatform $platform): int
74  {
75  $platformName = static::getPlatformIdentifier($platform);
76 
77  return self::$bindParameterLimits[$platformName];
78  }
79 
88  protected static function ‪getPlatformIdentifier(AbstractPlatform $platform): string
89  {
90  if ($platform instanceof MySqlPlatform) {
91  return 'mysql';
92  }
93  if ($platform instanceof PostgreSqlPlatform) {
94  return 'postgresql';
95  }
96  if ($platform instanceof SQLServerPlatform) {
97  return 'sqlserver';
98  }
99  if ($platform instanceof SqlitePlatform) {
100  return 'sqlite';
101  }
102  throw new \RuntimeException(
103  'Unsupported Databaseplatform "' . get_class($platform) . '" detected in PlatformInformation',
104  1500958070
105  );
106  }
107 }
‪TYPO3\CMS\Core\Database\Platform\PlatformInformation\getPlatformIdentifier
‪static string getPlatformIdentifier(AbstractPlatform $platform)
Definition: PlatformInformation.php:86
‪TYPO3\CMS\Core\Database\Platform\PlatformInformation\getMaxBindParameters
‪static int getMaxBindParameters(AbstractPlatform $platform)
Definition: PlatformInformation.php:71
‪TYPO3\CMS\Core\Database\Platform\PlatformInformation\$identifierLimits
‪static array $identifierLimits
Definition: PlatformInformation.php:34
‪TYPO3\CMS\Core\Database\Platform\PlatformInformation\$bindParameterLimits
‪static array $bindParameterLimits
Definition: PlatformInformation.php:43
‪TYPO3\CMS\Core\Database\Platform
Definition: PlatformInformation.php:4
‪TYPO3\CMS\Core\Database\Platform\PlatformInformation
Definition: PlatformInformation.php:31
‪TYPO3\CMS\Core\Database\Platform\PlatformInformation\getMaxIdentifierLength
‪static int getMaxIdentifierLength(AbstractPlatform $platform)
Definition: PlatformInformation.php:57