Metadot can't write NULL values to the database.
Here is the general fix, plus the extra stuff so
Gizmo's can. Unfortunately some parts of Metadot may
rely on this bug.
What now?
sqlInsert and sqlUpdate have something like this
foreach (keys %data) {
if (/^-/) {
s/^-//;
$sql.="\n $_ = $data{-$_} " . ",";
} else {
$sql.="\n $_ = ".$dbh->quote($data{$_}).",";
}
$names.="$_,";
}
... but need something like this
foreach my $key (keys %data) {
if ($key =~ /^-/) {
if ( defined($data{$key}) && ($data{$key} ne '')
) {
$values .= "\n ".$data{$key}.",";
} else {
$values .= "\nNULL,";
}
$key =~ s/^-//;
} else {
$values.="\n ".$dbh->quote($data{$key}).",";
}
$names.="$key,";
}
In Gizmp.pm 'add' and 'save'
have something like tihs
i1 => $self->\{i1\}, i2 => $self->\{i2\}, i3 => $self->\{i3\}, i4 => $self->\{i4\}, i5 => $self->\{i5\},
... but need something like this
-i1 => $self->\{i1\}, -i2 => $self->\{i2\}, -i3 => $self->\{i3\}, -i4 => $self->\{i4\}, -i5 => $self->\{i5\},
------------------------------------