From 457eaef9ecbd56e9b96f554669784a71a6862df7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mudr=C3=A1k?= Date: Thu, 21 Dec 2017 14:51:35 +0100 Subject: [PATCH] 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. --- lib/ddl/mssql_sql_generator.php | 4 ---- lib/ddl/oracle_sql_generator.php | 4 ---- lib/xmldb/xmldb_field.php | 4 ---- 3 files changed, 12 deletions(-) diff --git a/lib/ddl/mssql_sql_generator.php b/lib/ddl/mssql_sql_generator.php index a71b2257235..8caa81a58e4 100644 --- a/lib/ddl/mssql_sql_generator.php +++ b/lib/ddl/mssql_sql_generator.php @@ -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; diff --git a/lib/ddl/oracle_sql_generator.php b/lib/ddl/oracle_sql_generator.php index 8deccf98fbe..063eddb6e88 100644 --- a/lib/ddl/oracle_sql_generator.php +++ b/lib/ddl/oracle_sql_generator.php @@ -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)) { diff --git a/lib/xmldb/xmldb_field.php b/lib/xmldb/xmldb_field.php index 0a5062adade..7e7900bd2d7 100644 --- a/lib/xmldb/xmldb_field.php +++ b/lib/xmldb/xmldb_field.php @@ -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';