@@ 166-188 (lines=23) @@ | ||
163 | * |
|
164 | * @return array<integer,mixed|string> 0 if operation was successful |
|
165 | */ |
|
166 | public function clusterIndex($table = '', $index = '') |
|
167 | { |
|
168 | $sql = 'CLUSTER'; |
|
169 | ||
170 | // We don't bother with a transaction here, as there's no point rolling |
|
171 | // back an expensive cluster if a cheap analyze fails for whatever reason |
|
172 | ||
173 | if (!empty($table)) { |
|
174 | $f_schema = $this->_schema; |
|
175 | $this->fieldClean($f_schema); |
|
176 | $this->fieldClean($table); |
|
177 | $sql .= " \"{$f_schema}\".\"{$table}\""; |
|
178 | ||
179 | if (!empty($index)) { |
|
180 | $this->fieldClean($index); |
|
181 | $sql .= " USING \"{$index}\""; |
|
182 | } |
|
183 | } |
|
184 | ||
185 | $status = $this->execute($sql); |
|
186 | ||
187 | return [$status, $sql]; |
|
188 | } |
|
189 | ||
190 | /** |
|
191 | * Returns a list of all constraints on a table, |
@@ 309-332 (lines=24) @@ | ||
306 | * |
|
307 | * @return array 0 if operation was successful |
|
308 | */ |
|
309 | public function clusterIndex($table = '', $index = '') |
|
310 | { |
|
311 | $sql = 'CLUSTER'; |
|
312 | ||
313 | // We don't bother with a transaction here, as there's no point rolling |
|
314 | // back an expensive cluster if a cheap analyze fails for whatever reason |
|
315 | ||
316 | if (!empty($table)) { |
|
317 | $f_schema = $this->_schema; |
|
318 | $this->fieldClean($f_schema); |
|
319 | $this->fieldClean($table); |
|
320 | ||
321 | if (!empty($index)) { |
|
322 | $this->fieldClean($index); |
|
323 | $sql .= " \"{$index}\" ON \"{$f_schema}\".\"{$table}\""; |
|
324 | } else { |
|
325 | $sql .= " \"{$f_schema}\".\"{$table}\""; |
|
326 | } |
|
327 | } |
|
328 | ||
329 | $status = $this->execute($sql); |
|
330 | ||
331 | return [$status, $sql]; |
|
332 | } |
|
333 | ||
334 | // Operator functions |
|
335 |