Code Duplication    Length = 16-18 lines in 2 locations

src/database/Postgres.php 2 locations

@@ 1633-1650 (lines=18) @@
1630
1631
                // Output privileges with no GRANT OPTION
1632
                $sql .= 'GRANT '.implode(', ', $nongrant)." ON TABLE \"{$t->fields['relname']}\" TO ";
1633
                switch ($v[0]) {
1634
                    case 'public':
1635
                        $sql .= "PUBLIC;\n";
1636
                        break;
1637
                    case 'user':
1638
                        $this->fieldClean($v[1]);
1639
                        $sql .= "\"{$v[1]}\";\n";
1640
                        break;
1641
                    case 'group':
1642
                        $this->fieldClean($v[1]);
1643
                        $sql .= "GROUP \"{$v[1]}\";\n";
1644
                        break;
1645
                    default:
1646
                        // Unknown privilege type - fail
1647
                        $this->rollbackTransaction();
1648
1649
                        return;
1650
                }
1651
1652
                // Reset user if necessary
1653
                if ($this->hasGrantOption() && $v[3] != $t->fields['relowner']) {
@@ 1672-1687 (lines=16) @@
1669
                }
1670
1671
                $sql .= 'GRANT '.implode(', ', $v[4])." ON \"{$t->fields['relname']}\" TO ";
1672
                switch ($v[0]) {
1673
                    case 'public':
1674
                        $sql .= 'PUBLIC';
1675
                        break;
1676
                    case 'user':
1677
                        $this->fieldClean($v[1]);
1678
                        $sql .= "\"{$v[1]}\"";
1679
                        break;
1680
                    case 'group':
1681
                        $this->fieldClean($v[1]);
1682
                        $sql .= "GROUP \"{$v[1]}\"";
1683
                        break;
1684
                    default:
1685
                        // Unknown privilege type - fail
1686
                        return;
1687
                }
1688
                $sql .= " WITH GRANT OPTION;\n";
1689
1690
                // Reset user if necessary