Postgres::createFtsConfiguration PHP Метод

createFtsConfiguration() публичный Метод

Creates a new FTS configuration.
public createFtsConfiguration ( string $cfgname, string $parser = '', string $template = '', string $comment = '' )
$cfgname string The name of the FTS configuration to create
$parser string The parser to be used in new FTS configuration
$template string The existing FTS configuration to be used as template for the new one
$comment string If omitted, defaults to nothing
    function createFtsConfiguration($cfgname, $parser = '', $template = '', $comment = '')
    {
        $f_schema = $this->_schema;
        $this->fieldClean($f_schema);
        $this->fieldClean($cfgname);
        $sql = "CREATE TEXT SEARCH CONFIGURATION \"{$f_schema}\".\"{$cfgname}\" (";
        if ($parser != '') {
            $this->fieldClean($parser['schema']);
            $this->fieldClean($parser['parser']);
            $parser = "\"{$parser['schema']}\".\"{$parser['parser']}\"";
            $sql .= " PARSER = {$parser}";
        }
        if ($template != '') {
            $this->fieldClean($template['schema']);
            $this->fieldClean($template['name']);
            $sql .= " COPY = \"{$template['schema']}\".\"{$template['name']}\"";
        }
        $sql .= ")";
        if ($comment != '') {
            $status = $this->beginTransaction();
            if ($status != 0) {
                return -1;
            }
        }
        // Create the FTS configuration
        $status = $this->execute($sql);
        if ($status != 0) {
            $this->rollbackTransaction();
            return -1;
        }
        // Set the comment
        if ($comment != '') {
            $status = $this->setComment('TEXT SEARCH CONFIGURATION', $cfgname, '', $comment);
            if ($status != 0) {
                $this->rollbackTransaction();
                return -1;
            }
            return $this->endTransaction();
        }
        return 0;
    }
Postgres