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

Hartmaier Alexander alexander.hartmaier at t-systems.at
Thu Apr 17 17:10:38 GMT 2014


On 2014-04-17 16:10, Adam Witney wrote:
>
>
> On 17. 4. 2014 14:34, Hartmaier Alexander wrote:
>> On 2014-04-17 15:29, Adam Witney wrote:
>>>
>>>
>>> On 17. 4. 2014 14:20, Hartmaier Alexander wrote:
>>>> 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!
>>>
>>> But this gives the same error as without the on_connect_call.
>> Show us your complete code and look at which sql queries are executed
>> after connecting using DBIC_TRACE.
>
> It is just running this SQL query
>
> SELECT me.id, me.description, me.created_on, me.user_id FROM
> audit_log_changeset me WHERE ( me.id = ? ): '1'
You need to show use the whole log from when the Catalyst app is started
and first connects to the database.
>
> My model is
>
> package My::Model::DB;
>
> use strict;
> use base 'Catalyst::Model::DBIC::Schema';
>
> __PACKAGE__->config(
>     schema_class => 'My::Schema',
>     connect_info => {
>         dsn => 'dbi:Pg:dbname=db1',
>         user => 'test',
>         options => { AutoCommit => 0 },
>         on_connect_call => 'datetime_setup',
>      }
> );
This looks ok to me.

>
> And the timestamp field, "created_on", is within
> DBIx::Class::AuditLog::Changeset
>
> http://search.cpan.org/~ioncache/DBIx-Class-AuditLog-0.6.0/lib/DBIx/Class/Schema/AuditLog/Structure/Changeset.pm
>
>
> And i just have
>
> [% auditlog.Changeset.created_on %]
>
> in my template
>
> Thanks again
>
> _______________________________________________
> 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