From bf6655a534a6775d30cafa67bd801276bda1d98d Mon Sep 17 00:00:00 2001 From: polo Date: Tue, 13 Aug 2024 23:45:21 +0200 Subject: =?UTF-8?q?VERSION=200.2=20doctrine=20ORM=20et=20entit=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/doctrine/dbal/src/Driver/PDO/Statement.php | 80 +++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 vendor/doctrine/dbal/src/Driver/PDO/Statement.php (limited to 'vendor/doctrine/dbal/src/Driver/PDO/Statement.php') diff --git a/vendor/doctrine/dbal/src/Driver/PDO/Statement.php b/vendor/doctrine/dbal/src/Driver/PDO/Statement.php new file mode 100644 index 0000000..4f0e070 --- /dev/null +++ b/vendor/doctrine/dbal/src/Driver/PDO/Statement.php @@ -0,0 +1,80 @@ +convertParamType($type); + + try { + $this->stmt->bindValue($param, $value, $pdoType); + } catch (PDOException $exception) { + throw Exception::new($exception); + } + } + + /** + * @internal Driver options can be only specified by a PDO-based driver. + * + * @throws ExceptionInterface + */ + public function bindParamWithDriverOptions( + string|int $param, + mixed &$variable, + ParameterType $type, + mixed $driverOptions, + ): void { + $pdoType = $this->convertParamType($type); + + try { + $this->stmt->bindParam($param, $variable, $pdoType, 0, $driverOptions); + } catch (PDOException $exception) { + throw Exception::new($exception); + } + } + + public function execute(): Result + { + try { + $this->stmt->execute(); + } catch (PDOException $exception) { + throw Exception::new($exception); + } + + return new Result($this->stmt); + } + + /** + * Converts DBAL parameter type to PDO parameter type + * + * @psalm-return PDO::PARAM_* + */ + private function convertParamType(ParameterType $type): int + { + return match ($type) { + ParameterType::NULL => PDO::PARAM_NULL, + ParameterType::INTEGER => PDO::PARAM_INT, + ParameterType::STRING, + ParameterType::ASCII => PDO::PARAM_STR, + ParameterType::BINARY, + ParameterType::LARGE_OBJECT => PDO::PARAM_LOB, + ParameterType::BOOLEAN => PDO::PARAM_BOOL, + }; + } +} -- cgit v1.2.3