mirror of
https://github.com/moodle/moodle.git
synced 2025-01-29 11:46:19 +01:00
MDL-59596 ddl: Support MariaDB 10.2.4+ SQL_MODE new default value.
This commit is contained in:
parent
f6b16e95a8
commit
1f8d943461
@ -321,6 +321,27 @@ class mysql_sql_generator extends sql_generator {
|
||||
return $sqls;
|
||||
}
|
||||
|
||||
public function getAlterFieldSQL($xmldb_table, $xmldb_field, $skip_type_clause = NULL, $skip_default_clause = NULL, $skip_notnull_clause = NULL)
|
||||
{
|
||||
$tablename = $xmldb_table->getName();
|
||||
$dbcolumnsinfo = $this->mdb->get_columns($tablename);
|
||||
|
||||
if (($this->mdb->has_breaking_change_sqlmode()) &&
|
||||
($dbcolumnsinfo[$xmldb_field->getName()]->meta_type == 'X') &&
|
||||
($xmldb_field->getType() == XMLDB_TYPE_INTEGER)) {
|
||||
// Ignore 1292 ER_TRUNCATED_WRONG_VALUE Truncated incorrect INTEGER value: '%s'.
|
||||
$altercolumnsqlorig = $this->alter_column_sql;
|
||||
$this->alter_column_sql = str_replace('ALTER TABLE', 'ALTER IGNORE TABLE', $this->alter_column_sql);
|
||||
$result = parent::getAlterFieldSQL($xmldb_table, $xmldb_field, $skip_type_clause, $skip_default_clause, $skip_notnull_clause);
|
||||
// Restore the original ALTER SQL statement pattern.
|
||||
$this->alter_column_sql = $altercolumnsqlorig;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
return parent::getAlterFieldSQL($xmldb_table, $xmldb_field, $skip_type_clause, $skip_default_clause, $skip_notnull_clause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given one correct xmldb_table, returns the SQL statements
|
||||
* to create temporary table (inside one array).
|
||||
|
Loading…
x
Reference in New Issue
Block a user