1 | <?php |
||
20 | class Insert extends Common\Insert |
||
21 | { |
||
22 | /** |
||
23 | * |
||
24 | * if true, use a REPLACE sql command instead of INSERT |
||
25 | * |
||
26 | * @var bool |
||
27 | * |
||
28 | */ |
||
29 | private $use_replace = false; |
||
30 | |||
31 | /** |
||
32 | * |
||
33 | * Column values for ON DUPLICATE KEY UPDATE section of query; the key is |
||
34 | * the column name and the value is the column value. |
||
35 | * |
||
36 | * @param array |
||
37 | * |
||
38 | */ |
||
39 | protected $col_on_update_values; |
||
40 | |||
41 | /** |
||
42 | * |
||
43 | * Use a REPLACE statement. |
||
44 | * Matches similar orReplace() function for Sqlite |
||
45 | * |
||
46 | * @param bool $enable Set or unset flag (default true). |
||
47 | * |
||
48 | * @return $this |
||
49 | * |
||
50 | */ |
||
51 | 1 | public function orReplace($enable = true) |
|
56 | |||
57 | /** |
||
58 | * |
||
59 | * Adds or removes HIGH_PRIORITY flag. |
||
60 | * |
||
61 | * @param bool $enable Set or unset flag (default true). |
||
62 | * |
||
63 | * @return $this |
||
64 | * |
||
65 | */ |
||
66 | 1 | public function highPriority($enable = true) |
|
71 | |||
72 | /** |
||
73 | * |
||
74 | * Adds or removes LOW_PRIORITY flag. |
||
75 | * |
||
76 | * @param bool $enable Set or unset flag (default true). |
||
77 | * |
||
78 | * @return $this |
||
79 | * |
||
80 | */ |
||
81 | 1 | public function lowPriority($enable = true) |
|
86 | |||
87 | /** |
||
88 | * |
||
89 | * Adds or removes IGNORE flag. |
||
90 | * |
||
91 | * @param bool $enable Set or unset flag (default true). |
||
92 | * |
||
93 | * @return $this |
||
94 | * |
||
95 | */ |
||
96 | 1 | public function ignore($enable = true) |
|
101 | |||
102 | /** |
||
103 | * |
||
104 | * Adds or removes DELAYED flag. |
||
105 | * |
||
106 | * @param bool $enable Set or unset flag (default true). |
||
107 | * |
||
108 | * @return $this |
||
109 | * |
||
110 | */ |
||
111 | 1 | public function delayed($enable = true) |
|
116 | |||
117 | /** |
||
118 | * |
||
119 | * Sets one column value placeholder in ON DUPLICATE KEY UPDATE section; |
||
120 | * if an optional second parameter is passed, that value is bound to the |
||
121 | * placeholder. |
||
122 | * |
||
123 | * @param string $col The column name. |
||
124 | * |
||
125 | * @param array $value Optional: a value to bind to the placeholder. |
||
126 | * |
||
127 | * @return $this |
||
128 | * |
||
129 | */ |
||
130 | 1 | public function onDuplicateKeyUpdateCol($col, ...$value) |
|
140 | |||
141 | /** |
||
142 | * |
||
143 | * Sets multiple column value placeholders in ON DUPLICATE KEY UPDATE |
||
144 | * section. If an element is a key-value pair, the key is treated as the |
||
145 | * column name and the value is bound to that column. |
||
146 | * |
||
147 | * @param array $cols A list of column names, optionally as key-value |
||
148 | * pairs where the key is a column name and the value is a bind value for |
||
149 | * that column. |
||
150 | * |
||
151 | * @return $this |
||
152 | * |
||
153 | */ |
||
154 | 1 | public function onDuplicateKeyUpdateCols(array $cols) |
|
168 | |||
169 | /** |
||
170 | * |
||
171 | * Sets a column value directly in ON DUPLICATE KEY UPDATE section; the |
||
172 | * value will not be escaped, although fully-qualified identifiers in the |
||
173 | * value will be quoted. |
||
174 | * |
||
175 | * @param string $col The column name. |
||
176 | * |
||
177 | * @param string $value The column value expression. |
||
178 | * |
||
179 | * @return $this |
||
180 | * |
||
181 | */ |
||
182 | 1 | public function onDuplicateKeyUpdate($col, $value) |
|
193 | |||
194 | /** |
||
195 | * |
||
196 | * Builds this query object into a string. |
||
197 | * |
||
198 | * @return string |
||
199 | * |
||
200 | */ |
||
201 | 12 | protected function build() |
|
210 | |||
211 | /** |
||
212 | * |
||
213 | * Builds the UPDATE ON DUPLICATE KEY part of the statement. |
||
214 | * |
||
215 | * @return string |
||
216 | * |
||
217 | */ |
||
218 | 12 | protected function buildValuesForUpdateOnDuplicateKey() |
|
232 | } |
||
233 |