mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
MDL-59583 dml: fixed breaking change added w/ MariaDB 10.2.7+
This commit is contained in:
parent
dae6c5dc31
commit
0510d5c757
@ -88,6 +88,12 @@ class mariadb_native_moodle_database extends mysqli_native_moodle_database {
|
||||
return array('description'=>$this->mysqli->server_info, 'version'=>$version);
|
||||
}
|
||||
|
||||
protected function has_breaking_change_quoted_defaults() {
|
||||
$version = $this->get_server_info()['version'];
|
||||
// Breaking change since 10.2.7: MDEV-13132.
|
||||
return version_compare($version, '10.2.7', '>=');
|
||||
}
|
||||
|
||||
/**
|
||||
* It is time to require transactions everywhere.
|
||||
*
|
||||
|
@ -783,6 +783,14 @@ class mysqli_native_moodle_database extends moodle_database {
|
||||
return $structure;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether column information retrieved from `information_schema.columns` has default values quoted or not.
|
||||
* @return boolean True when default values are quoted (breaking change); otherwise, false.
|
||||
*/
|
||||
protected function has_breaking_change_quoted_defaults() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns moodle column info for raw column from information schema.
|
||||
* @param stdClass $rawcolumn
|
||||
@ -794,7 +802,11 @@ class mysqli_native_moodle_database extends moodle_database {
|
||||
$info->name = $rawcolumn->column_name;
|
||||
$info->type = $rawcolumn->data_type;
|
||||
$info->meta_type = $this->mysqltype2moodletype($rawcolumn->data_type);
|
||||
$info->default_value = $rawcolumn->column_default;
|
||||
if ($this->has_breaking_change_quoted_defaults()) {
|
||||
$info->default_value = trim($rawcolumn->column_default, "'");
|
||||
} else {
|
||||
$info->default_value = $rawcolumn->column_default;
|
||||
}
|
||||
$info->has_default = !is_null($rawcolumn->column_default);
|
||||
$info->not_null = ($rawcolumn->is_nullable === 'NO');
|
||||
$info->primary_key = ($rawcolumn->column_key === 'PRI');
|
||||
|
Loading…
x
Reference in New Issue
Block a user