diff options
author | polo <ordipolo@gmx.fr> | 2024-08-13 23:45:21 +0200 |
---|---|---|
committer | polo <ordipolo@gmx.fr> | 2024-08-13 23:45:21 +0200 |
commit | bf6655a534a6775d30cafa67bd801276bda1d98d (patch) | |
tree | c6381e3f6c81c33eab72508f410b165ba05f7e9c /vendor/doctrine/orm/src/Utility/LockSqlHelper.php | |
parent | 94d67a4b51f8e62e7d518cce26a526ae1ec48278 (diff) | |
download | AppliGestionPHP-bf6655a534a6775d30cafa67bd801276bda1d98d.zip |
VERSION 0.2 doctrine ORM et entités
Diffstat (limited to 'vendor/doctrine/orm/src/Utility/LockSqlHelper.php')
-rw-r--r-- | vendor/doctrine/orm/src/Utility/LockSqlHelper.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/vendor/doctrine/orm/src/Utility/LockSqlHelper.php b/vendor/doctrine/orm/src/Utility/LockSqlHelper.php new file mode 100644 index 0000000..7d135eb --- /dev/null +++ b/vendor/doctrine/orm/src/Utility/LockSqlHelper.php | |||
@@ -0,0 +1,35 @@ | |||
1 | <?php | ||
2 | |||
3 | declare(strict_types=1); | ||
4 | |||
5 | namespace Doctrine\ORM\Utility; | ||
6 | |||
7 | use Doctrine\DBAL\Platforms\AbstractMySQLPlatform; | ||
8 | use Doctrine\DBAL\Platforms\AbstractPlatform; | ||
9 | use Doctrine\DBAL\Platforms\DB2Platform; | ||
10 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; | ||
11 | use Doctrine\DBAL\Platforms\SQLitePlatform; | ||
12 | use Doctrine\DBAL\Platforms\SQLServerPlatform; | ||
13 | |||
14 | /** @internal */ | ||
15 | trait LockSqlHelper | ||
16 | { | ||
17 | private function getReadLockSQL(AbstractPlatform $platform): string | ||
18 | { | ||
19 | return match (true) { | ||
20 | $platform instanceof AbstractMySQLPlatform => 'LOCK IN SHARE MODE', | ||
21 | $platform instanceof PostgreSQLPlatform => 'FOR SHARE', | ||
22 | default => $this->getWriteLockSQL($platform), | ||
23 | }; | ||
24 | } | ||
25 | |||
26 | private function getWriteLockSQL(AbstractPlatform $platform): string | ||
27 | { | ||
28 | return match (true) { | ||
29 | $platform instanceof DB2Platform => 'WITH RR USE AND KEEP UPDATE LOCKS', | ||
30 | $platform instanceof SQLitePlatform, | ||
31 | $platform instanceof SQLServerPlatform => '', | ||
32 | default => 'FOR UPDATE', | ||
33 | }; | ||
34 | } | ||
35 | } | ||