Fix for grade_letter table and how MySQL version 5.0.3+ handles DECIMAL

fields

Versions: 5.0.3+ truncate to 99.99 if a value of 100.00 or greater is
input for grade_high or grade_low.

See the following for more info:
http://dev.mysql.com/doc/refman/5.0/en/precision-math-decimal-changes.html
This commit is contained in:
jgraham909
2006-07-17 22:38:58 +00:00
parent 25cbc9d08f
commit f8100e3629
2 changed files with 8 additions and 2 deletions
+6
View File
@@ -1978,6 +1978,12 @@ function main_upgrade($oldversion=0) {
table_column("user", "lastIP", "lastip", "varchar", "15", "", "", "not null", "currentlogin");
}
// Change in MySQL 5.0.3 concerning how decimals are stored
if ($oldversion < 2006070300) {
execute_sql("ALTER TABLE `{$CFG->prefix}grade_letter MODIFY `grade_high` DECIMAL(5,2)", FALSE);
execute_sql("ALTER TABLE `{$CFG->prefix}grade_letter MODIFY `grade_low` DECIMAL(5,2)", FALSE);
}
return $result;
}
+2 -2
View File
@@ -341,8 +341,8 @@ CREATE TABLE `prefix_grade_letter` (
`id` int(10) unsigned NOT NULL auto_increment,
`courseid` int(10) unsigned NOT NULL default '0',
`letter` varchar(8) NOT NULL default 'NA',
`grade_high` decimal(4,2) NOT NULL default '100.00',
`grade_low` decimal(4,2) NOT NULL default '0.00',
`grade_high` decimal(5,2) NOT NULL default '100.00',
`grade_low` decimal(5,2) NOT NULL default '0.00',
PRIMARY KEY (`id`),
KEY `courseid` (`courseid`)
) TYPE=MyISAM ;