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;
}