On 9/30/05, Uwe Voelker <[EMAIL PROTECTED]> wrote:
> 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 error message is "Column 'DATUM2' cannot be null".
>
> I know what you'll say: make the column 'NULL' and it works this way.

Yeah, that's one option.  Have you tried defining the column like this?

  DATUM2 => { type => 'date', not_null => 1, default => '0000-00-00' }

If that doesn't work, I'll probably try to make it work.

> 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'.

Then what happens when someone actually wants to insert a NULL in a date column?

-John


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to