1 | <?php |
||
15 | class Command extends \yii\db\Command |
||
16 | { |
||
17 | |||
18 | /** |
||
19 | * @var array pending parameters to be bound to the current PDO statement. |
||
20 | */ |
||
21 | private $_pendingParams = []; |
||
22 | |||
23 | /** |
||
24 | * @var string the SQL statement that this command represents |
||
25 | */ |
||
26 | private $_sql; |
||
27 | |||
28 | /** |
||
29 | * @var string name of the table, which schema, should be refreshed after command execution. |
||
30 | */ |
||
31 | private $_refreshTableName; |
||
32 | |||
33 | /** |
||
34 | * Binds a parameter to the SQL statement to be executed. |
||
35 | * @param string|integer $name parameter identifier. For a prepared statement |
||
36 | * using named placeholders, this will be a parameter name of |
||
37 | * the form `:name`. For a prepared statement using question mark |
||
38 | * placeholders, this will be the 1-indexed position of the parameter. |
||
39 | * @param mixed $value Name of the PHP variable to bind to the SQL statement parameter |
||
40 | * @param integer $dataType SQL data type of the parameter. If null, the type is determined by the PHP type of the value. |
||
41 | * @param integer $length length of the data type |
||
42 | * @param mixed $driverOptions the driver-specific options |
||
43 | * @return static the current command being executed |
||
44 | * @see http://www.php.net/manual/en/function.PDOStatement-bindParam.php |
||
45 | */ |
||
46 | 1 | public function bindParam($name, &$value, $dataType = null, $length = null, $driverOptions = null) |
|
53 | /** |
||
54 | * Binds pending parameters that were registered via [[bindValue()]] and [[bindValues()]]. |
||
55 | * Note that this method requires an active [[pdoStatement]]. |
||
56 | */ |
||
57 | 128 | protected function bindPendingParams() |
|
68 | |||
69 | /** |
||
70 | * Returns the SQL statement for this command. |
||
71 | * @return string the SQL statement to be executed |
||
72 | */ |
||
73 | 131 | public function getSql() |
|
77 | |||
78 | /** |
||
79 | * Specifies the SQL statement to be executed. |
||
80 | * The previous SQL execution (if any) will be cancelled, and [[params]] will be cleared as well. |
||
81 | * @param string $sql the SQL statement to be set. |
||
82 | * @return static this command instance |
||
83 | */ |
||
84 | 136 | public function setSql($sql) |
|
108 | |||
109 | /** |
||
110 | * Returns the raw SQL by inserting parameter values into the corresponding placeholders in [[sql]]. |
||
111 | * Note that the return value of this method should mainly be used for logging purpose. |
||
112 | * It is likely that this method returns an invalid SQL due to improper replacement of parameter placeholders. |
||
113 | * @return string the raw SQL with parameter values inserted into the corresponding placeholders in [[sql]]. |
||
114 | */ |
||
115 | 132 | public function getRawSql() |
|
144 | |||
145 | /** |
||
146 | * Binds a value to a parameter. |
||
147 | * @param string|integer $name Parameter identifier. For a prepared statement |
||
148 | * using named placeholders, this will be a parameter name of |
||
149 | * the form `:name`. For a prepared statement using question mark |
||
150 | * placeholders, this will be the 1-indexed position of the parameter. |
||
151 | * @param mixed $value The value to bind to the parameter |
||
152 | * @param integer $dataType SQL data type of the parameter. If null, the type is determined by the PHP type of the value. |
||
153 | * @return static the current command being executed |
||
154 | * @see http://www.php.net/manual/en/function.PDOStatement-bindValue.php |
||
155 | */ |
||
156 | 2 | public function bindValue($name, $value, $dataType = null) |
|
169 | |||
170 | /** |
||
171 | * Binds a list of values to the corresponding parameters. |
||
172 | * This is similar to [[bindValue()]] except that it binds multiple values at a time. |
||
173 | * Note that the SQL data type of each value is determined by its PHP type. |
||
174 | * @param array $values the values to be bound. This must be given in terms of an associative |
||
175 | * array with array keys being the parameter names, and array values the corresponding parameter values, |
||
176 | * e.g. `[':name' => 'John', ':age' => 25]`. By default, the PDO type of each value is determined |
||
177 | * by its PHP type. You may explicitly specify the PDO type by using an array: `[value, type]`, |
||
178 | * e.g. `[':name' => 'John', ':profile' => [$profile, \PDO::PARAM_LOB]]`. |
||
179 | * @return static the current command being executed |
||
180 | */ |
||
181 | 136 | public function bindValues($values) |
|
201 | |||
202 | /** |
||
203 | * Marks a specified table schema to be refreshed after command execution. |
||
204 | * @param string $name name of the table, which schema should be refreshed. |
||
205 | * @return $this this command instance |
||
206 | * @since 2.0.6 |
||
207 | */ |
||
208 | 4 | protected function requireTableSchemaRefresh($name) |
|
213 | |||
214 | /** |
||
215 | * Refreshes table schema, which was marked by [[requireTableSchemaRefresh()]] |
||
216 | * @since 2.0.6 |
||
217 | */ |
||
218 | 42 | protected function refreshTableSchema() |
|
224 | } |
||
225 |