[TYPO3-core] RFC: Bug #7589: FULLTEXT keys are not processed correctly

Michael Stucki michael at typo3.org
Thu Feb 21 01:53:05 CET 2008


Hi Dmitry,

> Problem: FULLTEXT keys are not processed by EM/Install correctly.
> EM/Install prompt to add these keys and do not recognize that keys already
> exist. The problem is in parser, who does not process "FULLTEXT KEY name
> (fiellist)" correctly.
> 
> Solution: use the attached patch to fix the parser.

I already wrote a similar fix for it. Here are some suggestions:

#1: Code simplification:
-       if ($parts[0]!='PRIMARY' && $parts[0]!='KEY' && $parts[0]!='UNIQUE')    {
+       if (!preg_match('/PRIMARY|UNIQUE|FULLTEXT|INDEX|KEY/',$parts[0])) {

#2: Deal with alternative codings like "FULLTEXT" / "FULLTEXT KEY", etc.
+               // Key definition
+       $search = array('/PRIMARY KEY/', '/UNIQUE (INDEX|KEY)/', '/FULLTEXT (INDEX|KEY)/');
+       $replace = array('PRIMARY', 'UNIQUE', 'FULLTEXT');
+       $parts[0] = preg_replace($search, $replace, $parts[0]);

The rest of the code looks fine with one exception:

-                               } else {
+                               }
+                               elseif ($keyRow['Index_type'] == 'FULLTEXT') {
+                                       $tempKeysPrefix[$tableName][$keyRow['Key_name']] = 'FULLTEXT KEY ' . $keyRow['Key_name'];
+                               }
+                               else {

No newline between "}" and "else"!

Cheers, michael
-- 
Use a newsreader! Check out
http://typo3.org/community/mailing-lists/use-a-news-reader/


More information about the TYPO3-team-core mailing list