@@ 295-329 (lines=35) @@ | ||
292 | * |
|
293 | * @return bool|int 0 on success |
|
294 | */ |
|
295 | public function updateFtsConfiguration($cfgname, $comment, $name) |
|
296 | { |
|
297 | $status = $this->beginTransaction(); |
|
298 | if ($status != 0) { |
|
299 | $this->rollbackTransaction(); |
|
300 | ||
301 | return -1; |
|
302 | } |
|
303 | ||
304 | $this->fieldClean($cfgname); |
|
305 | ||
306 | $status = $this->setComment('TEXT SEARCH CONFIGURATION', $cfgname, '', $comment); |
|
307 | if ($status != 0) { |
|
308 | $this->rollbackTransaction(); |
|
309 | ||
310 | return -1; |
|
311 | } |
|
312 | ||
313 | // Only if the name has changed |
|
314 | if ($name != $cfgname) { |
|
315 | $f_schema = $this->_schema; |
|
316 | $this->fieldClean($f_schema); |
|
317 | $this->fieldClean($name); |
|
318 | ||
319 | $sql = "ALTER TEXT SEARCH CONFIGURATION \"{$f_schema}\".\"{$cfgname}\" RENAME TO \"{$name}\""; |
|
320 | $status = $this->execute($sql); |
|
321 | if ($status != 0) { |
|
322 | $this->rollbackTransaction(); |
|
323 | ||
324 | return -1; |
|
325 | } |
|
326 | } |
|
327 | ||
328 | return $this->endTransaction(); |
|
329 | } |
|
330 | ||
331 | /** |
|
332 | * Creates a new FTS dictionary or FTS dictionary template. |
|
@@ 432-465 (lines=34) @@ | ||
429 | * |
|
430 | * @return bool|int 0 on success |
|
431 | */ |
|
432 | public function updateFtsDictionary($dictname, $comment, $name) |
|
433 | { |
|
434 | $status = $this->beginTransaction(); |
|
435 | if ($status != 0) { |
|
436 | $this->rollbackTransaction(); |
|
437 | ||
438 | return -1; |
|
439 | } |
|
440 | ||
441 | $this->fieldClean($dictname); |
|
442 | $status = $this->setComment('TEXT SEARCH DICTIONARY', $dictname, '', $comment); |
|
443 | if ($status != 0) { |
|
444 | $this->rollbackTransaction(); |
|
445 | ||
446 | return -1; |
|
447 | } |
|
448 | ||
449 | // Only if the name has changed |
|
450 | if ($name != $dictname) { |
|
451 | $f_schema = $this->_schema; |
|
452 | $this->fieldClean($f_schema); |
|
453 | $this->fieldClean($name); |
|
454 | ||
455 | $sql = "ALTER TEXT SEARCH DICTIONARY \"{$f_schema}\".\"{$dictname}\" RENAME TO \"{$name}\""; |
|
456 | $status = $this->execute($sql); |
|
457 | if ($status != 0) { |
|
458 | $this->rollbackTransaction(); |
|
459 | ||
460 | return -1; |
|
461 | } |
|
462 | } |
|
463 | ||
464 | return $this->endTransaction(); |
|
465 | } |
|
466 | ||
467 | /** |
|
468 | * Return all information relating to a FTS dictionary. |