TYPO3 CMS  TYPO3_8-7
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 
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 }
static static getMaxIdentifierLength(AbstractPlatform $platform)
static getMaxBindParameters(AbstractPlatform $platform)
static getPlatformIdentifier(AbstractPlatform $platform)