[Dbix-class] DateTime Inflations for Timestamps

Ryan Cone metrext at gmail.com
Mon Jun 8 18:31:51 GMT 2009


On Jun 8, 2009, at 1:47 PM, Peter Rabbitson wrote:

> 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.
>>
>> DBIx::Class::InflateColumn::DateTime seems like the right place to
>> handle these timestamp inflations, but perhaps some other DateTime
>> Fomatter requires that timestamps be datetimes?  Just trying to  
>> figure
>> out the best way to move forward.  Any of these seem like better  
>> options?
>>
>> - Patch the file on my end
>> - Get my company to switch to MySQL
>> - Make an Oracle specific DateTime Inflator
>> - Work with the owner to change the module to treat timestamps as
>> timestamps
>> - Work with the owner to change the module to treat timestamps as
>> timestamps when connected to Oracle
>>
>> Any advice is appreciated.  Thanks.
>
> See if DBIx::Class 0.08103 does what you want
>

Yes, it works (and has been working) as expected.  Thanks to Matt  
Trout for pointing me to this list with my issue and to all  
contributors Inflate DateTime and otherwise.

Now the fun work of teaching our app to behave as nicely as the  
Inflate Column modules.






More information about the DBIx-Class mailing list