diff options
Diffstat (limited to 'vendor/doctrine/dbal/src/Driver/PDO/SQLSrv/Statement.php')
-rw-r--r-- | vendor/doctrine/dbal/src/Driver/PDO/SQLSrv/Statement.php | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/vendor/doctrine/dbal/src/Driver/PDO/SQLSrv/Statement.php b/vendor/doctrine/dbal/src/Driver/PDO/SQLSrv/Statement.php new file mode 100644 index 0000000..44cecc9 --- /dev/null +++ b/vendor/doctrine/dbal/src/Driver/PDO/SQLSrv/Statement.php | |||
@@ -0,0 +1,46 @@ | |||
1 | <?php | ||
2 | |||
3 | declare(strict_types=1); | ||
4 | |||
5 | namespace Doctrine\DBAL\Driver\PDO\SQLSrv; | ||
6 | |||
7 | use Doctrine\DBAL\Driver\Middleware\AbstractStatementMiddleware; | ||
8 | use Doctrine\DBAL\Driver\PDO\Statement as PDOStatement; | ||
9 | use Doctrine\DBAL\ParameterType; | ||
10 | use PDO; | ||
11 | |||
12 | final class Statement extends AbstractStatementMiddleware | ||
13 | { | ||
14 | /** @internal The statement can be only instantiated by its driver connection. */ | ||
15 | public function __construct(private readonly PDOStatement $statement) | ||
16 | { | ||
17 | parent::__construct($statement); | ||
18 | } | ||
19 | |||
20 | public function bindValue(int|string $param, mixed $value, ParameterType $type): void | ||
21 | { | ||
22 | switch ($type) { | ||
23 | case ParameterType::LARGE_OBJECT: | ||
24 | case ParameterType::BINARY: | ||
25 | $this->statement->bindParamWithDriverOptions( | ||
26 | $param, | ||
27 | $value, | ||
28 | $type, | ||
29 | PDO::SQLSRV_ENCODING_BINARY, | ||
30 | ); | ||
31 | break; | ||
32 | |||
33 | case ParameterType::ASCII: | ||
34 | $this->statement->bindParamWithDriverOptions( | ||
35 | $param, | ||
36 | $value, | ||
37 | ParameterType::STRING, | ||
38 | PDO::SQLSRV_ENCODING_SYSTEM, | ||
39 | ); | ||
40 | break; | ||
41 | |||
42 | default: | ||
43 | $this->statement->bindValue($param, $value, $type); | ||
44 | } | ||
45 | } | ||
46 | } | ||