* API/Setup/MySQL: fixed backup to correctly report boolean columns and support MySQL 5.0+ varchar(>255)

This commit is contained in:
Ralf Becker 2012-08-12 09:50:56 +00:00
parent 6bfb87de00
commit 1d36c1710f

View File

@ -127,6 +127,14 @@ class schema_proc
case 'maxdb':
$this->max_varchar_length = 8000;
break;
case 'mysql':
// since MySQL 5.0 65535, but with utf8 and row-size-limit of 64k:
// it's effective 65535/3 - size of other columns, so we use 20000 (mysql silently convert to text anyway)
if ((float)$this->m_odb->ServerInfo['version'] >= 5.0)
{
$this->max_varchar_length = 20000;
}
break;
}
if (is_object($GLOBALS['egw_setup']))
{
@ -1155,7 +1163,7 @@ class schema_proc
function GetTableDefinition($sTableName)
{
// MetaType returns all varchar >= blobSize as blob, it's by default 100, which is wrong
if ($this->dict->blobSize < 255) $this->dict->blobSize = 255;
$this->dict->blobSize = $this->max_varchar_length;
if (!method_exists($this->dict,'MetaColumns') ||
!($columns = $this->dict->MetaColumns($sTableName)))
@ -1266,6 +1274,14 @@ class schema_proc
$column->has_default = False;
}
}
// fix MySQL stores bool columns as smallint
if ($this->sType == 'mysql' && $definition['fd'][$name]['precision'] == 1 &&
$this->m_odb->get_column_attribute($name, $sTableName, true, 'type') === 'bool')
{
$definition['fd'][$name]['type'] = 'bool';
unset($definition['fd'][$name]['precision']);
$column->default_value = (bool)$column->default_value;
}
break;
}
if ($column->has_default)