1 | <?php |
||
20 | class Insert extends Common\Insert |
||
21 | { |
||
22 | /** |
||
23 | * |
||
24 | * Column values for ON DUPLICATE KEY UPDATE section of query; the key is |
||
25 | * the column name and the value is the column value. |
||
26 | * |
||
27 | * @param array |
||
28 | * |
||
29 | */ |
||
30 | protected $col_on_update_values; |
||
31 | |||
32 | /** |
||
33 | * |
||
34 | * Adds or removes HIGH_PRIORITY flag. |
||
35 | * |
||
36 | * @param bool $enable Set or unset flag (default true). |
||
37 | * |
||
38 | * @return $this |
||
39 | * |
||
40 | */ |
||
41 | 1 | public function highPriority($enable = true) |
|
46 | |||
47 | /** |
||
48 | * |
||
49 | * Adds or removes LOW_PRIORITY flag. |
||
50 | * |
||
51 | * @param bool $enable Set or unset flag (default true). |
||
52 | * |
||
53 | * @return $this |
||
54 | * |
||
55 | */ |
||
56 | 1 | public function lowPriority($enable = true) |
|
61 | |||
62 | /** |
||
63 | * |
||
64 | * Adds or removes IGNORE flag. |
||
65 | * |
||
66 | * @param bool $enable Set or unset flag (default true). |
||
67 | * |
||
68 | * @return $this |
||
69 | * |
||
70 | */ |
||
71 | 1 | public function ignore($enable = true) |
|
76 | |||
77 | /** |
||
78 | * |
||
79 | * Adds or removes DELAYED flag. |
||
80 | * |
||
81 | * @param bool $enable Set or unset flag (default true). |
||
82 | * |
||
83 | * @return $this |
||
84 | * |
||
85 | */ |
||
86 | 1 | public function delayed($enable = true) |
|
91 | |||
92 | /** |
||
93 | * |
||
94 | * Sets one column value placeholder in ON DUPLICATE KEY UPDATE section; |
||
95 | * if an optional second parameter is passed, that value is bound to the |
||
96 | * placeholder. |
||
97 | * |
||
98 | * @param string $col The column name. |
||
99 | * |
||
100 | * @param array $value Optional: a value to bind to the placeholder. |
||
101 | * |
||
102 | * @return $this |
||
103 | * |
||
104 | */ |
||
105 | 1 | public function onDuplicateKeyUpdateCol($col, ...$value) |
|
115 | |||
116 | /** |
||
117 | * |
||
118 | * Sets multiple column value placeholders in ON DUPLICATE KEY UPDATE |
||
119 | * section. If an element is a key-value pair, the key is treated as the |
||
120 | * column name and the value is bound to that column. |
||
121 | * |
||
122 | * @param array $cols A list of column names, optionally as key-value |
||
123 | * pairs where the key is a column name and the value is a bind value for |
||
124 | * that column. |
||
125 | * |
||
126 | * @return $this |
||
127 | * |
||
128 | */ |
||
129 | 1 | public function onDuplicateKeyUpdateCols(array $cols) |
|
143 | |||
144 | /** |
||
145 | * |
||
146 | * Sets a column value directly in ON DUPLICATE KEY UPDATE section; the |
||
147 | * value will not be escaped, although fully-qualified identifiers in the |
||
148 | * value will be quoted. |
||
149 | * |
||
150 | * @param string $col The column name. |
||
151 | * |
||
152 | * @param string $value The column value expression. |
||
153 | * |
||
154 | * @return $this |
||
155 | * |
||
156 | */ |
||
157 | 1 | public function onDuplicateKeyUpdate($col, $value) |
|
168 | |||
169 | /** |
||
170 | * |
||
171 | * Builds this query object into a string. |
||
172 | * |
||
173 | * @return string |
||
174 | * |
||
175 | */ |
||
176 | 11 | protected function build() |
|
185 | |||
186 | /** |
||
187 | * |
||
188 | * Builds the UPDATE ON DUPLICATE KEY part of the statement. |
||
189 | * |
||
190 | * @return string |
||
191 | * |
||
192 | */ |
||
193 | 11 | protected function buildValuesForUpdateOnDuplicateKey() |
|
207 | } |
||
208 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.