Code Duplication    Length = 22-23 lines in 2 locations

src/database/Postgres.php 1 location

@@ 4516-4537 (lines=22) @@
4513
     * @param \PHPPgAdmin\Database\The|string $index The name of the index
4514
     * @return \PHPPgAdmin\Database\A 0 success
4515
     */
4516
    public function clusterIndex($table = '', $index = '')
4517
    {
4518
        $sql = 'CLUSTER';
4519
4520
        // We don't bother with a transaction here, as there's no point rolling
4521
        // back an expensive cluster if a cheap analyze fails for whatever reason
4522
4523
        if (!empty($table)) {
4524
            $f_schema = $this->_schema;
4525
            $this->fieldClean($f_schema);
4526
            $this->fieldClean($table);
4527
            $sql .= " \"{$f_schema}\".\"{$table}\"";
4528
4529
            if (!empty($index)) {
4530
                $this->fieldClean($index);
4531
                $sql .= " USING \"{$index}\"";
4532
            }
4533
        }
4534
4535
        return $this->execute($sql);
4536
    }
4537
4538
    /**
4539
     * Returns a list of all constraints on a table,
4540
     * including constraint name, definition, related col and referenced namespace,

src/database/Postgres82.php 1 location

@@ 297-319 (lines=23) @@
294
         * @param \PHPPgAdmin\Database\The|string $index The name of the index
295
         * @return \PHPPgAdmin\Database\A 0 success
296
         */
297
        public function clusterIndex($table = '', $index = '')
298
        {
299
            $sql = 'CLUSTER';
300
301
            // We don't bother with a transaction here, as there's no point rolling
302
            // back an expensive cluster if a cheap analyze fails for whatever reason
303
304
            if (!empty($table)) {
305
                $f_schema = $this->_schema;
306
                $this->fieldClean($f_schema);
307
                $this->fieldClean($table);
308
309
                if (!empty($index)) {
310
                    $this->fieldClean($index);
311
                    $sql .= " \"{$index}\" ON \"{$f_schema}\".\"{$table}\"";
312
                } else {
313
                    $sql .= " \"{$f_schema}\".\"{$table}\"";
314
                }
315
            }
316
317
            return $this->execute($sql);
318
        }
319
320
        // Operator functions
321
322
        /**