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

Hartmaier Alexander alexander.hartmaier at t-systems.at
Thu Apr 17 13:20:12 GMT 2014


On 2014-04-17 14:37, Adam Witney 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'"]],
It should be on_connect_call => 'datatime_setup', literally!

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



*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien
Handelsgericht Wien, FN 79340b
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
Notice: This e-mail contains information that is confidential and may be privileged.
If you are not the intended recipient, please notify the sender and then
delete this e-mail immediately.
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*



More information about the DBIx-Class mailing list