[Typo3] warning message in php_error.log / not a valid MySQL

Editha Kuske info at editha-kuske.de
Fri Feb 18 14:26:10 CET 2005


Hi Stefan				

I have the same problem with the DB Compare.
First Problem is, that mysql (my current version 4.1.10) doesn't like a field-definition like:
>>uid int(11) unsigned DEFAULT '0' NOT NULL auto_increment<<
I found in class.t3lib_install.php the line:

var $mysqlVersion = "3.22";		// 3.22 or 3.23	If set to 3.23, then the expected format of the incoming sql-dump files are changed. 'DEFAULT' and 'NOT NULL' are reversed in order and 'DEFAULT' is lowercase. Also auto_incremented fields are without default definitions.

and changed the version to 3.23

But this made it only a little bit better

In the function assembleFieldDefinition() I did a patch after that my $hstr at the end of the function
was correct.
Patch:
function assembleFieldDefinition($row)	
{
		$field[] = $row["Type"];
/*EK patch !!!!!

		if ($this->mysqlVersion=="3.23" && !$row["Null"])	{
			$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"]))."'";
			}
		}
//EK  hier is not equal - I think, that is ok !!!		
		if ($this->mysqlVersion!="3.23" && !$row["Null"])	{
			$field[] = "NOT NULL";
		}
		if ($row["Extra"])	{
			$field[] = $row["Extra"];
		}
//EK
		$hstr =implode($field," ");
		echo $hstr."<br>";
		return implode($field," ");
	}

But the problem stays, that the DB Compare recommends many field changes, that are not necessary
and after ok its th same (or more bad, because my table sys_trackbeuser is away now)

I think the problem has its origin in the the ext_tables.sql Files.
I'll be happy, if someone knows what to do.

- Editha Kuske (kuskeea)

-----------------------
This thread is located in the archive at this URL:
http://typo3.org/documentation/mailing-lists/english-main-list-archive/thread/11195/
					



More information about the TYPO3-english mailing list