mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 04:30:15 +01:00
MDL-29566 mysql - length / decimal specs in float columns are optional
This commit is contained in:
parent
12e89a0a69
commit
61e55061a6
@ -489,7 +489,7 @@ class mysqli_native_moodle_database extends moodle_database {
|
||||
$info->unique = null;
|
||||
}
|
||||
|
||||
} else if (preg_match('/(decimal|double|float)\((\d+),(\d+)\)/i', $rawcolumn->type, $matches)) {
|
||||
} else if (preg_match('/(decimal)\((\d+),(\d+)\)/i', $rawcolumn->type, $matches)) {
|
||||
$info->type = $matches[1];
|
||||
$info->meta_type = 'N';
|
||||
$info->max_length = $matches[2];
|
||||
@ -503,6 +503,20 @@ class mysqli_native_moodle_database extends moodle_database {
|
||||
$info->auto_increment= false;
|
||||
$info->unique = null;
|
||||
|
||||
} else if (preg_match('/(double|float)(\((\d+),(\d+)\))?/i', $rawcolumn->type, $matches)) {
|
||||
$info->type = $matches[1];
|
||||
$info->meta_type = 'N';
|
||||
$info->max_length = isset($matches[3]) ? $matches[3] : null;
|
||||
$info->scale = isset($matches[4]) ? $matches[4] : null;
|
||||
$info->not_null = ($rawcolumn->null === 'NO');
|
||||
$info->default_value = $rawcolumn->default;
|
||||
$info->has_default = is_null($info->default_value) ? false : true;
|
||||
$info->primary_key = ($rawcolumn->key === 'PRI');
|
||||
$info->binary = false;
|
||||
$info->unsigned = (stripos($rawcolumn->type, 'unsigned') !== false);
|
||||
$info->auto_increment= false;
|
||||
$info->unique = null;
|
||||
|
||||
} else if (preg_match('/([a-z]*text)/i', $rawcolumn->type, $matches)) {
|
||||
$info->type = $matches[1];
|
||||
$info->meta_type = 'X';
|
||||
|
Loading…
x
Reference in New Issue
Block a user