#1116 (and #1117): default values for ENUMs must always be expressed as strings.

SVN:trunk[3668]
This commit is contained in:
Denis Flaven
2015-08-03 15:33:37 +00:00
parent f84f17a5be
commit 90d5f5b8cf

View File

@@ -2656,6 +2656,22 @@ class AttributeEnum extends AttributeString
return "VARCHAR(255)".($bFullSpec ? " DEFAULT ''" : ""); // ENUM() is not an allowed syntax!
}
}
protected function GetSQLColSpec()
{
$default = $this->ScalarToSQL($this->GetDefaultValue());
if (is_null($default))
{
$sRet = '';
}
else
{
// ENUMs values are strings so the default value must be a string as well,
// otherwise MySQL interprets the number as the zero-based index of the value in the list (i.e. the nth value in the list)
$sRet = " DEFAULT ".CMDBSource::Quote($default);
}
return $sRet;
}
public function ScalarToSQL($value)
{