MDL-24192 fixed null default value in text fields

This commit is contained in:
Petr Skoda 2010-09-14 15:40:01 +00:00
parent b809f81392
commit 559d79d25e

View File

@ -478,7 +478,11 @@ class mssql_native_moodle_database extends moodle_database {
// Process defaults
$info->has_default = !empty($rawcolumn->default_value);
$info->default_value = preg_replace("/^[\(N]+[']?(.*?)[']?[\)]+$/", '\\1', $rawcolumn->default_value);
if ($rawcolumn->default_value === NULL) {
$info->default_value = NULL;
} else {
$info->default_value = preg_replace("/^[\(N]+[']?(.*?)[']?[\)]+$/", '\\1', $rawcolumn->default_value);
}
// Process binary
$info->binary = $info->meta_type == 'B' ? true : false;