[Dbix-class] DateTime Inflations for Timestamps

Ryan Cone metrext at gmail.com
Thu Apr 30 19:53:52 GMT 2009


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



More information about the DBIx-Class mailing list