Project

General

Profile

Bug #14354 » class.t3lib_install_5.diff

Administrator Admin, 2005-04-07 21:51

View differences:

t3lib/class.t3lib_install.php 7 Apr 2005 19:14:55 -0000
} else {
$lineV = ereg_replace(',$','',$value);
$parts = explode(' ',$lineV,2);
if(stristr($parts[1],'auto_increment')) {
$parts[1] = eregi_replace(' DEFAULT \'0\'','',$parts[1]);
}
if ($parts[0]!='PRIMARY' && $parts[0]!='KEY' && $parts[0]!='UNIQUE') {
$total[$isTable]['fields'][$parts[0]] = $parts[1];
} else {
......
if (is_array($info['fields'])) {
foreach($info['fields'] as $fN => $fV) {
if ($info['whole_table']) {
if(!strcmp($fN,'uid')) {
if(strstr($fV,'auto_increment')) {
$fV = eregi_replace('default \'0\'','',$fV);
}
}
$whole_table[]=$fN.' '.$fV;
} else {
if ($theKey=='extra') {
......
$field[] = 'NOT NULL';
}
if (!strstr($row['Type'],'blob') && !strstr($row['Type'],'text')) {
// This code will return a default value if the sql-file version is not 3.23 and the field is not auto-incremented. In 3.23 files, the auto-incremented fields do not have a default definition.
// Furthermore if the file is 3.22 the default value of auto-incremented fields are expected to always be zero which is why the default value is passed through intval(). Thus it should work on 3.23 MySQL servers.
if ($this->mysqlVersion!='3.23' || !stristr($row['Extra'],'auto_increment')) {
$field[] = ($this->mysqlVersion=='3.23'?'default':'DEFAULT')." '".(stristr($row['Extra'],'auto_increment')?intval($row['Default']):addslashes($row['Default']))."'";
// This code will return a default value if the field is not auto-incremented (these fields never have a default definition).
if(!stristr($row['Extra'],'auto_increment')) {
$field[] = 'DEFAULT'." '".addslashes($row['Default'])."'";
}
}
if ($this->mysqlVersion!='3.23' && !$row['Null']) {
......
if (eregi('^create[[:space:]]*table[[:space:]]*([[:alnum:]_]*)',substr($linecontent,0,100),$reg)) {
$table = trim($reg[1]);
if ($table) {
if (TYPO3_OS=='WIN') {$table=strtolower($table);} // tablenames are always lowercase on windows!
if (TYPO3_OS=='WIN') { $table=strtolower($table); } // tablenames are always lowercase on windows!
$sqlLines=explode(chr(10), $linecontent);
for ($i=0; $i < count($sqlLines); $i++) {
if(stristr($sqlLines[$i],'auto_increment')) {
$sqlLines[$i] = eregi_replace(' DEFAULT \'0\'','',$sqlLines[$i]);
}
}
$linecontent = implode (chr(10), $sqlLines);
$crTables[$table] = $linecontent;
}
} elseif ($insertCountFlag && eregi('^insert[[:space:]]*into[[:space:]]*([[:alnum:]_]*)',substr($linecontent,0,100),$reg)) {
(5-5/6)