[Dbix-class] DateTime Inflations for Timestamps

Alexander Hartmaier alexander.hartmaier at t-systems.at
Mon May 4 09:15:01 GMT 2009


Am Freitag, den 01.05.2009, 00:48 +0200 schrieb Matt S Trout:
> On Thu, Apr 30, 2009 at 03:53:52PM -0400, Ryan Cone wrote:
> > Can anyone provide some insight into why timestamps are treated as
> > datetimes in DBIx::Class::InflateColumn::DateTime?
> >
> > Line 63:    $type = 'datetime' if ($type =~ /^timestamp/);
> >
> >
> > I am using DBIC with Oracle and I am trying to distinguish between
> > columns that are Date and Date Time accurate.  In the database and the
> > models, I am using Date and Timestamp to represent the two types.  But
> > a bit of unlucky coincidence prevents me from loading
> > InflateColumn::DateTime as a component...
> >
> > 1.  InflateColumn makes the timestamp a datetime.
> > 2.  DateTime::Format::Oracle makes the datetime a date (rightly so I
> > think since dates and datetimes are synonymous in Oracle).
> >
> > For now, I am adding custom Inflates using DateTime::Format::Oracle's
> > parse_date and parse_timestamp and those work as expected.  But
> > eventually it would be nice to have something that can be loaded.
>
> How about patching InflateColumn::DateTime so that if there -are-
> parse_timestamp and format_timestamp methods it uses those, and then it
> falls back to the _datetime methods if not?
>
> Looks to me like we simply didn't realise that there were DateTime::Format::
> modules that had separate timestamp support - in fact more accurately *I*
> didn't realise that at the time.
>
> Do the other Oracle users on here want to weigh in on this please?
>

I use only 'DATE' columns (for the non-oracle guys, this stores date
*and* time, stupid naming) and have a similar issue, I only want to
store a date.
Is there an in-/deflator for date-only columns?

--
BR Alex


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