Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge branch 'm33_MDL-59596_DDL_Issues_With_MariaDB_10p2_SQLMode' of h…
- Loading branch information
|
@@ -321,6 +321,27 @@ public function getAddFieldSQL($xmldb_table, $xmldb_field, $skip_type_clause = N |
|
|
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). |
|
|
|
@@ -94,6 +94,12 @@ protected function has_breaking_change_quoted_defaults() { |
|
|
return version_compare($version, '10.2.7', '>='); |
|
|
} |
|
|
|
|
|
public function has_breaking_change_sqlmode() { |
|
|
$version = $this->get_server_info()['version']; |
|
|
// Breaking change since 10.2.4: https://mariadb.com/kb/en/the-mariadb-library/sql-mode/#setting-sql_mode. |
|
|
return version_compare($version, '10.2.4', '>='); |
|
|
} |
|
|
|
|
|
/** |
|
|
* It is time to require transactions everywhere. |
|
|
* |
|
|
|
@@ -817,6 +817,14 @@ protected function has_breaking_change_quoted_defaults() { |
|
|
return false; |
|
|
} |
|
|
|
|
|
/** |
|
|
* Indicates whether SQL_MODE default value has changed in a not backward compatible way. |
|
|
* @return boolean True when SQL_MODE breaks BC; otherwise, false. |
|
|
*/ |
|
|
public function has_breaking_change_sqlmode() { |
|
|
return false; |
|
|
} |
|
|
|
|
|
/** |
|
|
* Returns moodle column info for raw column from information schema. |
|
|
* @param stdClass $rawcolumn |
|
|