From: gbateson Date: Fri, 28 Apr 2006 02:11:52 +0000 (+0000) Subject: set negative values to 0, on unsigned numeric fields X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=e5d1941db7d689379f68d88f23b7e59dc7825527;p=moodle.git set negative values to 0, on unsigned numeric fields --- diff --git a/mod/hotpot/db/update_to_v2.php b/mod/hotpot/db/update_to_v2.php index 80523b6fbc..0bdd9c824b 100644 --- a/mod/hotpot/db/update_to_v2.php +++ b/mod/hotpot/db/update_to_v2.php @@ -75,6 +75,9 @@ function hotpot_denull_int_field($table, $field, $size, $unsigned=true) { $ok = true; $ok = $ok && execute_sql("UPDATE {$CFG->prefix}$table SET $field=0 WHERE $field IS NULL", false); + if ($unsigned) { + $ok = $ok && execute_sql("UPDATE {$CFG->prefix}$table SET $field=0 WHERE $field<0", false); + } $ok = $ok && hotpot_db_update_field_type($table, $field, $field, 'INTEGER', $size, $unsigned, 'NOT NULL', 0); return $ok;