Skip to content
Browse files

set negative values to 0, on unsigned numeric fields

  • Loading branch information...
1 parent c9441e3 commit e5d1941db7d689379f68d88f23b7e59dc7825527 gbateson committed Apr 28, 2006
Showing with 3 additions and 0 deletions.
  1. +3 −0 mod/hotpot/db/update_to_v2.php
View
3 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;

0 comments on commit e5d1941

Please sign in to comment.
Something went wrong with that request. Please try again.