Fixed bug #14496: SQL parser does not handle ALTER TABLE with character set operation
authorXavier Perseguers <typo3@perseguers.ch>
Thu, 27 May 2010 17:31:11 +0000 (17:31 +0000)
committerXavier Perseguers <typo3@perseguers.ch>
Thu, 27 May 2010 17:31:11 +0000 (17:31 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/dbal/trunk@33599 735d13b6-9817-0410-8766-e36946ffe9aa

typo3/sysext/dbal/ChangeLog
typo3/sysext/dbal/class.ux_t3lib_sqlparser.php
typo3/sysext/dbal/tests/sqlparser_general_testcase.php

index e597419..3bcb8ac 100644 (file)
@@ -1,5 +1,6 @@
 2010-05-27  Xavier Perseguers  <typo3@perseguers.ch>
 
+       * Fixed bug #14496: SQL parser does not handle ALTER TABLE with character set operation
        * Fixed bug #14456: SQL parser doesn't accept ALTER TABLE statement without CHANGE, DROP or ADD keyword
        * Fixed bug #14457: 1-2-3 Install Process breaks with PostgreSQL
 
index 7b1dcf9..1d9b088 100644 (file)
@@ -301,6 +301,7 @@ class ux_t3lib_sqlparser extends t3lib_sqlparser {
                                        case 'ADDUNIQUE':
                                                $query .= ' (' . implode(',', $components['fields']) . ')';
                                                break;
+                                       case 'DEFAULTCHARACTERSET':
                                        case 'ENGINE':
                                                // ??? todo!
                                                break;
index d4a6da0..ac45bf8 100644 (file)
@@ -352,6 +352,21 @@ class sqlparser_general_testcase extends BaseTestCase {
                $this->assertEquals($expected, $alterTable[0]);
        }
 
+       /**
+        * @test
+        * @see http://bugs.typo3.org/view.php?id=14496
+        */
+       public function canParseAlterCharacterSetStatement() {
+               $parseString = 'ALTER TABLE `index_phash` DEFAULT CHARACTER SET utf8';
+               $components = $this->fixture->_callRef('parseALTERTABLE', $parseString);
+
+               $this->assertTrue(is_array($components), $components);
+               $alterTable = $this->cleanSql($this->fixture->_callRef('compileALTERTABLE', $components));
+               $expected = 'ALTER TABLE index_phash DEFAULT CHARACTER SET utf8';
+               $this->assertTrue(is_array($alterTable), $alterTable);
+               $this->assertEquals($expected, $alterTable[0]);
+       }
+
        ///////////////////////////////////////
        // Tests concerning JOINs
        ///////////////////////////////////////