[Dbix-class] InflateColumn DateTime tricks with MSSQL/Microsoft_SQL_Server

Michael Higgins linux at evolone.org
Tue Jan 15 17:21:19 GMT 2008


On Tue, 15 Jan 2008 11:29:44 -0500
"Christopher H. Laco" <claco at chrislaco.com> wrote:

> Michael Higgins wrote:
> > Folks --
> > 
> > What I thought would be trivial turns to be burdensome. Probably,
> > it's just me, but:
> > 

[snip]

> > 
> > Any help appreciated. 
> > 
> 
> I'm late to the party, but I use this component a lot.

Excellent!

> First, is DateTime::Format::MySQL actually installed? (did this
> thread start about MySQL?)

Yes, that is installed. 

(I started a new thread since my question was answered, strictly
speaking.)

I got this odd error:
"DBIx::Class::InflateColumn::get_inflated_column(): Couldn't load
DateTime::Format::MySQL: Can't locate DateTime/Format/MySQL.pm"

... odd, since I'm not using MySQL, I couln't understand why the
InflateColumn::DateTime thing was asking for it. 

I am having to use Microsoft SQL Server.

> Second, InflateColumn::DateTime inflates db column values into
> DateTime objects.

Yes, that was my hope, as indicated in the DBIC module,
$rs->dtcolumn->mdy() should work after this is set up.

>  Keep this in mind though, that when you set values
> using accessors:

Not doing that at all. Just trying to output the values as returned as
some nice format, instead of '2008-01-14 00:00:00.000' as they are
coming now.

> Now, first things second: show us the source of your schema classes, 
> where you load this component and declate fields as a datetime type.


Okay.

Component is loaded like this:

__PACKAGE__->load_components(qw/PK::Auto InflateColumn::DateTime
Core/); 

In the 'package' that accesses the table.

Schema looks like: 'Order Date' =>{accessor=>'order_date', data_type =>
'datetime'},

(The actual data type is 'smalldatetime', but I don't see where that
string appears anywhere in my perl libraries.)

5.8.8 # grep -lr smalldate .
[]

Thanks!

Cheers,

-- 
 |\  /|        |   |          ~ ~  
 | \/ |        |---|          `|` ?
 |    |ichael  |   |iggins    \^ /
 michael.higgins[at]evolone[dot]org



More information about the DBIx-Class mailing list