function createFtsDictionary($dictname, $isTemplate = false, $template = '', $lexize = '', $init = '', $option = '', $comment = '')
{
$f_schema = $this->_schema;
$this->fieldClean($f_schema);
$this->fieldClean($dictname);
$this->fieldClean($template);
$this->fieldClean($lexize);
$this->fieldClean($init);
$this->fieldClean($option);
$sql = "CREATE TEXT SEARCH";
if ($isTemplate) {
$sql .= " TEMPLATE \"{$f_schema}\".\"{$dictname}\" (";
if ($lexize != '') {
$sql .= " LEXIZE = {$lexize}";
}
if ($init != '') {
$sql .= ", INIT = {$init}";
}
$sql .= ")";
$whatToComment = 'TEXT SEARCH TEMPLATE';
} else {
$sql .= " DICTIONARY \"{$f_schema}\".\"{$dictname}\" (";
if ($template != '') {
$this->fieldClean($template['schema']);
$this->fieldClean($template['name']);
$template = "\"{$template['schema']}\".\"{$template['name']}\"";
$sql .= " TEMPLATE = {$template}";
}
if ($option != '') {
$sql .= ", {$option}";
}
$sql .= ")";
$whatToComment = 'TEXT SEARCH DICTIONARY';
}
/* if comment, begin a transaction to
* run both commands */
if ($comment != '') {
$status = $this->beginTransaction();
if ($status != 0) {
return -1;
}
}
// Create the FTS dictionary
$status = $this->execute($sql);
if ($status != 0) {
$this->rollbackTransaction();
return -1;
}
// Set the comment
if ($comment != '') {
$status = $this->setComment($whatToComment, $dictname, '', $comment);
if ($status != 0) {
$this->rollbackTransaction();
return -1;
}
}
return $this->endTransaction();
}