MDL-32113 xmldb: Remove hard-coded exceptions for long number fields

We are going to unify the maximum supported precision of all numeric
fields to 38 digits (which are the current Oracle and MSSQL limits). Get
rid of hard-coded exceptions for longer fields.
This commit is contained in:
David Mudrák 2017-12-21 14:51:35 +01:00
parent 3cdb015828
commit 457eaef9ec
3 changed files with 0 additions and 12 deletions

View File

@ -194,10 +194,6 @@ class mssql_sql_generator extends sql_generator {
case XMLDB_TYPE_NUMBER:
$dbtype = $this->number_type;
if (!empty($xmldb_length)) {
// 38 is the max allowed
if ($xmldb_length > 38) {
$xmldb_length = 38;
}
$dbtype .= '(' . $xmldb_length;
if (!empty($xmldb_decimals)) {
$dbtype .= ',' . $xmldb_decimals;

View File

@ -181,10 +181,6 @@ class oracle_sql_generator extends sql_generator {
case XMLDB_TYPE_FLOAT:
case XMLDB_TYPE_NUMBER:
$dbtype = $this->number_type;
// 38 is the max allowed
if ($xmldb_length > 38) {
$xmldb_length = 38;
}
if (!empty($xmldb_length)) {
$dbtype .= '(' . $xmldb_length;
if (!empty($xmldb_decimals)) {

View File

@ -786,10 +786,6 @@ class xmldb_field extends xmldb_object {
case XMLDB_TYPE_NUMBER:
$maxlength = self::NUMBER_MAX_LENGTH;
if ($xmldb_table->getName() === 'question_numerical_units' and $name === 'multiplier') {
//TODO: remove after MDL-32113 is resolved
$maxlength = 40;
}
$length = $this->getLength();
if (!is_number($length) or $length <= 0 or $length > $maxlength) {
return 'Invalid field definition in table {'.$xmldb_table->getName().'}: XMLDB_TYPE_NUMBER field "'.$this->getName().'" has invalid length';