| 148 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
namespace Doctrine\DBAL\Driver;
|
|
|
4 |
|
|
|
5 |
use Doctrine\DBAL\ParameterType;
|
|
|
6 |
|
|
|
7 |
/**
|
|
|
8 |
* Driver-level statement
|
|
|
9 |
*/
|
|
|
10 |
interface Statement
|
|
|
11 |
{
|
|
|
12 |
/**
|
|
|
13 |
* Binds a value to a corresponding named (not supported by mysqli driver, see comment below) or positional
|
|
|
14 |
* placeholder in the SQL statement that was used to prepare the statement.
|
|
|
15 |
*
|
|
|
16 |
* As mentioned above, the named parameters are not natively supported by the mysqli driver, use executeQuery(),
|
|
|
17 |
* fetchAll(), fetchArray(), fetchColumn(), fetchAssoc() methods to have the named parameter emulated by doctrine.
|
|
|
18 |
*
|
|
|
19 |
* @param string|int $param Parameter identifier. For a prepared statement using named placeholders,
|
|
|
20 |
* this will be a parameter name of the form :name. For a prepared statement
|
|
|
21 |
* using question mark placeholders, this will be the 1-indexed position of the parameter.
|
|
|
22 |
* @param mixed $value The value to bind to the parameter.
|
|
|
23 |
* @param int $type Explicit data type for the parameter using the {@see ParameterType}
|
|
|
24 |
* constants.
|
|
|
25 |
*
|
|
|
26 |
* @return bool TRUE on success or FALSE on failure.
|
|
|
27 |
*
|
|
|
28 |
* @throws Exception
|
|
|
29 |
*/
|
|
|
30 |
public function bindValue($param, $value, $type = ParameterType::STRING);
|
|
|
31 |
|
|
|
32 |
/**
|
|
|
33 |
* Binds a PHP variable to a corresponding named (not supported by mysqli driver, see comment below) or question
|
|
|
34 |
* mark placeholder in the SQL statement that was use to prepare the statement. Unlike {@see bindValue()},
|
|
|
35 |
* the variable is bound as a reference and will only be evaluated at the time
|
|
|
36 |
* that PDOStatement->execute() is called.
|
|
|
37 |
*
|
|
|
38 |
* As mentioned above, the named parameters are not natively supported by the mysqli driver, use executeQuery(),
|
|
|
39 |
* fetchAll(), fetchArray(), fetchColumn(), fetchAssoc() methods to have the named parameter emulated by doctrine.
|
|
|
40 |
*
|
|
|
41 |
* Most parameters are input parameters, that is, parameters that are
|
|
|
42 |
* used in a read-only fashion to build up the query. Some drivers support the invocation
|
|
|
43 |
* of stored procedures that return data as output parameters, and some also as input/output
|
|
|
44 |
* parameters that both send in data and are updated to receive it.
|
|
|
45 |
*
|
|
|
46 |
* @deprecated Use {@see bindValue()} instead.
|
|
|
47 |
*
|
|
|
48 |
* @param string|int $param Parameter identifier. For a prepared statement using named placeholders,
|
|
|
49 |
* this will be a parameter name of the form :name. For a prepared statement using
|
|
|
50 |
* question mark placeholders, this will be the 1-indexed position of the parameter.
|
|
|
51 |
* @param mixed $variable Name of the PHP variable to bind to the SQL statement parameter.
|
|
|
52 |
* @param int $type Explicit data type for the parameter using the {@see ParameterType}
|
|
|
53 |
* constants.
|
|
|
54 |
* @param int|null $length You must specify maxlength when using an OUT bind
|
|
|
55 |
* so that PHP allocates enough memory to hold the returned value.
|
|
|
56 |
*
|
|
|
57 |
* @return bool TRUE on success or FALSE on failure.
|
|
|
58 |
*
|
|
|
59 |
* @throws Exception
|
|
|
60 |
*/
|
|
|
61 |
public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null);
|
|
|
62 |
|
|
|
63 |
/**
|
|
|
64 |
* Executes a prepared statement
|
|
|
65 |
*
|
|
|
66 |
* If the prepared statement included parameter markers, you must either:
|
|
|
67 |
* call {@see bindParam()} to bind PHP variables to the parameter markers:
|
|
|
68 |
* bound variables pass their value as input and receive the output value,
|
|
|
69 |
* if any, of their associated parameter markers or pass an array of input-only
|
|
|
70 |
* parameter values.
|
|
|
71 |
*
|
|
|
72 |
* @param mixed[]|null $params A numeric array of values with as many elements as there are
|
|
|
73 |
* bound parameters in the SQL statement being executed.
|
|
|
74 |
*
|
|
|
75 |
* @throws Exception
|
|
|
76 |
*/
|
|
|
77 |
public function execute($params = null): Result;
|
|
|
78 |
}
|