set negative values to 0, on unsigned numeric fields

This commit is contained in:
gbateson
2006-04-28 02:11:52 +00:00
parent c9441e34ca
commit e5d1941db7
+3
View 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;