Newbie trying to get DBIx::Class to work with Oracle DATE columns. Managed to get my error to go away, so I'm putting this out there for expert comment and for those newbies searching on the same problem.

I used dbicdump with components=["InflateColumn::DateTime"] on an Oracle schema which produced a Result class which has

__PACKAGE__->load_components("InflateColumn::DateTime"); ... __PACKAGE__->add_columns( "start_time", { data_type => "datetime", is_nullable => 1, original => { data_type => "date" }, }, );
but after searching with dbic and getting a resultset
$resultset = $schema->resultset('Ical') ->search({ uid => $id });
calling $resultset->start_time would give me DBIx::Class::InflateColumn::DateTime::catch {...} (): Error while inflating '24-APR-18' for start_time on Timetable::Schema::Result::Ical: Invalid date format: 24-APR-18. There are lots of hints in the documentation, but nothing explicit on how to avoid this error.

I found that the error went away when I added the on_connect_call option to the connect method.

my $schema = Timetable::Schema->connect("dbi:Oracle:$schema_name", $db_username, $db_password, {on_connect_call => 'datetime_setup'} );

Just thought I'd get it down while it was fresh in my mind and I'll update the post when I know more about what I've done.

ta!

Edit

The more documentation I read, the more I think I did the Right Thing.
  • How to connect
  • How to customize InflateColumn (which I didn't need)

    Ea

    Sometimes I can think of 6 impossible LDAP attributes before breakfast.

    Mojoconf was great!


    In reply to Dbic and inflating Oracle DATE columns - solved by Ea

    Title:
    Use:  <p> text here (a paragraph) </p>
    and:  <code> code here </code>
    to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.