Hello John,

it's "the ugly" MySQL again ;-)

Given this schema:

CREATE TABLE `DATUM` (
  `ID` int(10) unsigned NOT NULL auto_increment,
  `DATUM` datetime NOT NULL default '0000-00-00 00:00:00',
  `DATUM2` date NOT NULL default '0000-00-00',
  PRIMARY KEY  (`ID`)
)

I can not save a record without DATUM or DATUM2. See attached script. The errormessage is "Column 'DATUM2' cannot be null".

I know what you'll say: make the column 'NULL' and it works this way.

But: When you load such an object you correctly map '0000-00-00' to undef. Why can't it be the other way too? Saving 'undef' maps to '0000-00-00'.


Thanks,
bye, Uwe

Attachment: date-save.pl
Description: Perl program

Reply via email to