1<?php
2
3namespace Doctrine\DBAL\Driver\PDOSqlsrv;
4
5use Doctrine\DBAL\Driver\PDO;
6use Doctrine\DBAL\ParameterType;
7
8/**
9 * PDO SQL Server Statement
10 *
11 * @deprecated Use {@link PDO\SQLSrv\Statement} instead.
12 */
13class Statement extends PDO\Statement
14{
15    /**
16     * {@inheritdoc}
17     */
18    public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null, $driverOptions = null)
19    {
20        switch ($type) {
21            case ParameterType::LARGE_OBJECT:
22            case ParameterType::BINARY:
23                if ($driverOptions === null) {
24                    $driverOptions = \PDO::SQLSRV_ENCODING_BINARY;
25                }
26
27                break;
28
29            case ParameterType::ASCII:
30                $type          = ParameterType::STRING;
31                $length        = 0;
32                $driverOptions = \PDO::SQLSRV_ENCODING_SYSTEM;
33                break;
34        }
35
36        return parent::bindParam($param, $variable, $type, $length ?? 0, $driverOptions);
37    }
38
39    /**
40     * {@inheritdoc}
41     */
42    public function bindValue($param, $value, $type = ParameterType::STRING)
43    {
44        return $this->bindParam($param, $value, $type);
45    }
46}
47