Hydration
9 months ago
TopologicalSort
9 months ago
CriteriaOrderings.php
9 months ago
HydrationCompleteHandler.php
9 months ago
SQLResultCasing.php
9 months ago
StronglyConnectedComponents.php
9 months ago
TopologicalSort.php
9 months ago
index.php
9 months ago
SQLResultCasing.php
30 lines
| 1 | <?php |
| 2 | declare (strict_types=1); |
| 3 | namespace MailPoetVendor\Doctrine\ORM\Internal; |
| 4 | if (!defined('ABSPATH')) exit; |
| 5 | use MailPoetVendor\Doctrine\DBAL\Platforms\AbstractPlatform; |
| 6 | use MailPoetVendor\Doctrine\DBAL\Platforms\DB2Platform; |
| 7 | use MailPoetVendor\Doctrine\DBAL\Platforms\OraclePlatform; |
| 8 | use MailPoetVendor\Doctrine\DBAL\Platforms\PostgreSQLPlatform; |
| 9 | use function get_class; |
| 10 | use function method_exists; |
| 11 | use function strpos; |
| 12 | use function strtolower; |
| 13 | use function strtoupper; |
| 14 | trait SQLResultCasing |
| 15 | { |
| 16 | private function getSQLResultCasing(AbstractPlatform $platform, string $column) : string |
| 17 | { |
| 18 | if ($platform instanceof DB2Platform || $platform instanceof OraclePlatform) { |
| 19 | return strtoupper($column); |
| 20 | } |
| 21 | if ($platform instanceof PostgreSQLPlatform) { |
| 22 | return strtolower($column); |
| 23 | } |
| 24 | if (strpos(get_class($platform), 'MailPoetVendor\\Doctrine\\DBAL\\Platforms\\') !== 0 && method_exists(AbstractPlatform::class, 'getSQLResultCasing')) { |
| 25 | return $platform->getSQLResultCasing($column); |
| 26 | } |
| 27 | return $column; |
| 28 | } |
| 29 | } |
| 30 |