Permalink
Browse files

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
  • Loading branch information...
1 parent 25cbc9d commit f8100e36290e82ebfd3ea2f5e694b98ad8f5a786 jgraham909 committed Jul 17, 2006
Showing with 8 additions and 2 deletions.
  1. +6 −0 lib/db/mysql.php
  2. +2 −2 lib/db/mysql.sql
View
@@ -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;
}
View
@@ -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 ;

0 comments on commit f8100e3

Please sign in to comment.