[Dbix-class] Where to set database date format for InflateColumn::DateTime?

Will Crawford billcrawford1970 at gmail.com
Thu Apr 17 12:45:32 GMT 2014


Set the default value to be \'CURRENT_TIMESTAMP'

On 17 April 2014 13:37, Adam Witney <awitney at sgul.ac.uk> wrote:
>
>>> Great thanks,
>>>
>>>   on_connect_do => "SET datestyle = 'sql, mdy'",
>>>
>>> did the trick
>>
>> mea culpa! You should use on_connect_call => 'datetime_setup' which does
>> the right thing for every supported RDBMS, so you can use your model
>> e.g. for testing on sqlplus but deploy to postgres.
>
>
> ok great thanks, changed it to
>
> on_connect_call => [[ do_sql => "SET datestyle = 'sql, mdy'"]],
>
> Also a related question, I just created a record in this table, the date on
> the machine was
>
> $ date
> Thu Apr 17 13:30:41 BST 2014
>
> the date in the database was
>
> # select now();
> 17/04/2014 13:30:41.213018 BST
>
> but the timestamp field contained
>
> 17/04/2014 12:30:41
>
> ie an hour behind. I assume this is because the database/OS are using BST,
> but the application isn't.
>
> The Result class contains this
>
>     'created_on' => {
>         'data_type'     => 'timestamp',
>         'set_on_create' => 1,
>         'is_nullable'   => 0,
>     },
>
> I don't really understand what I need to set to make sure created records
> have the correct time, is this an on_connect_call job as well?
>
> Thanks again for any help
>
>
> Adam
>
>
>
> _______________________________________________
> 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/dbix-class@lists.scsys.co.uk



More information about the DBIx-Class mailing list