Code Duplication    Length = 35-36 lines in 2 locations

src/database/Postgres.php 2 locations

@@ 6985-7020 (lines=36) @@
6982
     *
6983
     * @return bool|int 0 on success
6984
     */
6985
    public function updateFtsConfiguration($cfgname, $comment, $name)
6986
    {
6987
        $status = $this->beginTransaction();
6988
        if ($status != 0) {
6989
            $this->rollbackTransaction();
6990
6991
            return -1;
6992
        }
6993
6994
        $this->fieldClean($cfgname);
6995
6996
        $status = $this->setComment('TEXT SEARCH CONFIGURATION', $cfgname, '', $comment);
6997
        if ($status != 0) {
6998
            $this->rollbackTransaction();
6999
7000
            return -1;
7001
        }
7002
7003
        // Only if the name has changed
7004
        if ($name != $cfgname) {
7005
            $f_schema = $this->_schema;
7006
            $this->fieldClean($f_schema);
7007
            $this->fieldClean($name);
7008
7009
            $sql = "ALTER TEXT SEARCH CONFIGURATION \"{$f_schema}\".\"{$cfgname}\" RENAME TO \"{$name}\"";
7010
            $status = $this->execute($sql);
7011
            if ($status != 0) {
7012
                $this->rollbackTransaction();
7013
7014
                return -1;
7015
            }
7016
        }
7017
7018
        return $this->endTransaction();
7019
    }
7020
7021
    /**
7022
     * Creates a new FTS dictionary or FTS dictionary template.
7023
     *
@@ 7122-7156 (lines=35) @@
7119
     *
7120
     * @return bool|int 0 on success
7121
     */
7122
    public function updateFtsDictionary($dictname, $comment, $name)
7123
    {
7124
        $status = $this->beginTransaction();
7125
        if ($status != 0) {
7126
            $this->rollbackTransaction();
7127
7128
            return -1;
7129
        }
7130
7131
        $this->fieldClean($dictname);
7132
        $status = $this->setComment('TEXT SEARCH DICTIONARY', $dictname, '', $comment);
7133
        if ($status != 0) {
7134
            $this->rollbackTransaction();
7135
7136
            return -1;
7137
        }
7138
7139
        // Only if the name has changed
7140
        if ($name != $dictname) {
7141
            $f_schema = $this->_schema;
7142
            $this->fieldClean($f_schema);
7143
            $this->fieldClean($name);
7144
7145
            $sql = "ALTER TEXT SEARCH DICTIONARY \"{$f_schema}\".\"{$dictname}\" RENAME TO \"{$name}\"";
7146
            $status = $this->execute($sql);
7147
            if ($status != 0) {
7148
                $this->rollbackTransaction();
7149
7150
                return -1;
7151
            }
7152
        }
7153
7154
        return $this->endTransaction();
7155
    }
7156
7157
    /**
7158
     * Return all information relating to a FTS dictionary.
7159
     *