Support NULL values for non-string database fields

develop
Sven Slootweg 11 years ago
parent 6e923629e0
commit 85371b3394

@ -226,6 +226,16 @@ abstract class CPHPDatabaseRecordClass extends CPHPBaseClass
$original_value = $this->uData[$column_name]; $original_value = $this->uData[$column_name];
if($original_value === "" && ($type == "timestamp" || $type == "numeric" || $type == "boolean"))
{
$variable_name_safe = "s" . $variable_name;
$this->$variable_name_safe = null;
$variable_name_unsafe = "u" . $variable_name;
$this->$variable_name_unsafe = null;
}
else
{
switch($type) switch($type)
{ {
case "string": case "string":
@ -297,6 +307,7 @@ abstract class CPHPDatabaseRecordClass extends CPHPBaseClass
$variable_name_unsafe = "u" . $variable_name; $variable_name_unsafe = "u" . $variable_name;
$this->$variable_name_unsafe = $original_value; $this->$variable_name_unsafe = $original_value;
} }
}
public function FillDefaults() public function FillDefaults()
{ {

Loading…
Cancel
Save