HEX
Server: Apache
System: Linux WWW 6.1.0-40-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.153-1 (2025-09-20) x86_64
User: web11 (1011)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /var/www/payments-gateway/vendor/doctrine/orm/src/Utility/LockSqlHelper.php
<?php

declare(strict_types=1);

namespace Doctrine\ORM\Utility;

use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\DB2Platform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SQLitePlatform;
use Doctrine\DBAL\Platforms\SQLServerPlatform;

/** @internal */
trait LockSqlHelper
{
    private function getReadLockSQL(AbstractPlatform $platform): string
    {
        return match (true) {
            $platform instanceof AbstractMySQLPlatform => 'LOCK IN SHARE MODE',
            $platform instanceof PostgreSQLPlatform => 'FOR SHARE',
            default => $this->getWriteLockSQL($platform),
        };
    }

    private function getWriteLockSQL(AbstractPlatform $platform): string
    {
        return match (true) {
            $platform instanceof DB2Platform => 'WITH RR USE AND KEEP UPDATE LOCKS',
            $platform instanceof SQLitePlatform,
            $platform instanceof SQLServerPlatform => '',
            default => 'FOR UPDATE',
        };
    }
}