]> git.mjollnir.org Git - moodle.git/commitdiff
set negative values to 0, on unsigned numeric fields
authorgbateson <gbateson>
Fri, 28 Apr 2006 02:11:52 +0000 (02:11 +0000)
committergbateson <gbateson>
Fri, 28 Apr 2006 02:11:52 +0000 (02:11 +0000)
mod/hotpot/db/update_to_v2.php

index 80523b6fbcb6730ff9c08bc2eb09387884f5cba0..0bdd9c824b54f5ad9851cebd85f8665afc5bc14d 100644 (file)
@@ -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;