The date you're getting is what you tend to get when MySQL sees that
there should be a value but can't parse the result.

Try passing in undef instead of an empty string and see if it works right.

On Mon, Oct 10, 2011 at 11:30 AM, Peter Wood <[email protected]> wrote:
> Hello,
> I'm trying to insert an empty string into a datetime field in MySQL version
> 5.0.18, using DBIx::Class version 0.08120. This particular field is defined
> like so, within a call to 'add_columns':
> __PACKAGE__->add_columns(
> ..snip..
> "start_date",
>   {
>     data_type => "DATETIME",
>     default_value => undef,
>     is_nullable => 1,
>     size => 19,
>   },
> ..snip..
> );
> If I provide a complete value for start_date (eg 2011-10-10 14:29:27),
> everything works fine. However, when I try to set it to the empty string
> (''), the value inserted in the database is '0000-00-00 00:00:00'. If I run
> an insert on the command-line mysql client, and provide the empty string as
> the value for that field, it properly sets an empty value in the database.
> Is there something else I should be doing to properly insert an empty string
> into this column?
> Thanks,
> Peter
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive:
> http://www.grokbase.com/group/[email protected]
>

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]

Reply via email to