Index: class.ux_t3lib_sqlparser.php =================================================================== --- class.ux_t3lib_sqlparser.php (revision 26669) +++ class.ux_t3lib_sqlparser.php (working copy) @@ -613,6 +613,7 @@ } // Add additional features: + $noQuote = TRUE; if (is_array($fieldCfg['featureIndex'])) { // MySQL assigns DEFAULT value automatically if NOT NULL, fake this here @@ -651,11 +652,16 @@ $cfg .= ' "\'\'"'; } else { $cfg .= ' ' . $featureDef['value'][1] . $this->compileAddslashes($featureDef['value'][0]) . $featureDef['value'][1]; + if (!is_numeric($featureDef['value'][0])) { + $noQuote = FALSE; + } } } } } - $cfg .= ' NOQUOTE'; + if ($noQuote) { + $cfg .= ' NOQUOTE'; + } break; } Index: tests/db_oracle_testcase.php =================================================================== --- tests/db_oracle_testcase.php (revision 26738) +++ tests/db_oracle_testcase.php (working copy) @@ -332,5 +332,44 @@ '); $this->assertEquals($expected, $this->cleanSql($sqlCommands[0])); } + + /** + * @test + * @see http://bugs.typo3.org/view.php?id=11142 + * @see http://bugs.typo3.org/view.php?id=12670 + */ + public function defaultValueIsProperlyQuotedInCreateTable() { + $parseString = ' + CREATE TABLE tx_test ( + uid int(11) NOT NULL auto_increment, + lastname varchar(60) DEFAULT \'unknown\' NOT NULL, + firstname varchar(60) DEFAULT \'\' NOT NULL, + language varchar(2) NOT NULL, + tstamp int(11) DEFAULT \'0\' NOT NULL, + + PRIMARY KEY (uid), + KEY name (name) + ); + '; + + $components = $GLOBALS['TYPO3_DB']->SQLparser->_callRef('parseCREATETABLE', $parseString); + $this->assertTrue(is_array($components), 'Not an array: ' . $components); + + $sqlCommands = $GLOBALS['TYPO3_DB']->SQLparser->_call('compileCREATETABLE', $components); + $this->assertTrue(is_array($sqlCommands), 'Not an array: ' . $sqlCommands); + $this->assertEquals(2, count($sqlCommands)); + + $expected = $this->cleanSql(' + CREATE TABLE "tx_test" ( + "uid" NUMBER(20) NOT NULL, + "lastname" VARCHAR(60) DEFAULT \'unknown\', + "firstname" VARCHAR(60) DEFAULT \'\', + "language" VARCHAR(2) NOT NULL, + "tstamp" NUMBER(20) DEFAULT 0, + PRIMARY KEY ("uid") + ) + '); + $this->assertEquals($expected, $this->cleanSql($sqlCommands[0])); + } } ?> \ No newline at end of file