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/dbal/src/Driver/PgSQL/ConvertParameters.php | |
| parent | 94d67a4b51f8e62e7d518cce26a526ae1ec48278 (diff) | |
| download | AppliGestionPHP-bf6655a534a6775d30cafa67bd801276bda1d98d.tar.gz AppliGestionPHP-bf6655a534a6775d30cafa67bd801276bda1d98d.tar.bz2 AppliGestionPHP-bf6655a534a6775d30cafa67bd801276bda1d98d.zip | |
VERSION 0.2 doctrine ORM et entités
Diffstat (limited to 'vendor/doctrine/dbal/src/Driver/PgSQL/ConvertParameters.php')
| -rw-r--r-- | vendor/doctrine/dbal/src/Driver/PgSQL/ConvertParameters.php | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/vendor/doctrine/dbal/src/Driver/PgSQL/ConvertParameters.php b/vendor/doctrine/dbal/src/Driver/PgSQL/ConvertParameters.php new file mode 100644 index 0000000..795f12d --- /dev/null +++ b/vendor/doctrine/dbal/src/Driver/PgSQL/ConvertParameters.php | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\DBAL\Driver\PgSQL; | ||
| 6 | |||
| 7 | use Doctrine\DBAL\SQL\Parser\Visitor; | ||
| 8 | |||
| 9 | use function count; | ||
| 10 | use function implode; | ||
| 11 | |||
| 12 | final class ConvertParameters implements Visitor | ||
| 13 | { | ||
| 14 | /** @var list<string> */ | ||
| 15 | private array $buffer = []; | ||
| 16 | |||
| 17 | /** @var array<array-key, int> */ | ||
| 18 | private array $parameterMap = []; | ||
| 19 | |||
| 20 | public function acceptPositionalParameter(string $sql): void | ||
| 21 | { | ||
| 22 | $position = count($this->parameterMap) + 1; | ||
| 23 | $this->parameterMap[$position] = $position; | ||
| 24 | $this->buffer[] = '$' . $position; | ||
| 25 | } | ||
| 26 | |||
| 27 | public function acceptNamedParameter(string $sql): void | ||
| 28 | { | ||
| 29 | $position = count($this->parameterMap) + 1; | ||
| 30 | $this->parameterMap[$sql] = $position; | ||
| 31 | $this->buffer[] = '$' . $position; | ||
| 32 | } | ||
| 33 | |||
| 34 | public function acceptOther(string $sql): void | ||
| 35 | { | ||
| 36 | $this->buffer[] = $sql; | ||
| 37 | } | ||
| 38 | |||
| 39 | public function getSQL(): string | ||
| 40 | { | ||
| 41 | return implode('', $this->buffer); | ||
| 42 | } | ||
| 43 | |||
| 44 | /** @return array<array-key, int> */ | ||
| 45 | public function getParameterMap(): array | ||
| 46 | { | ||
| 47 | return $this->parameterMap; | ||
| 48 | } | ||
| 49 | } | ||
