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

Michael Higgins linux at evolone.org
Tue Jan 15 17:40:03 GMT 2008


On Tue, 15 Jan 2008 16:58:03 +0000
Matt Lawrence <matt.lawrence at ymogen.net> wrote:

> Michael Higgins wrote:
> > The error I was getting is: Invalid date format: 2008-01-14
> > 00:00:00.000
> >
> > So, maybe this should be: return $type->new( pattern => '%m/%d/%Y
> > %H:%M:%S.%N' ); ???
> >   
> You should be able to set this by doing:
> 
>     $schema->storage->datetime_parser->pattern('%m/%d/%Y
> %H:%M:%S.%3N');

Done. No change.

> 
> this will obviously only work if the datetime parser is really a
> DateTime::Format::Strptime object.

I don't what this means. How can I check that?

> 
> > I've added the sub as above, with the nanosecond string,
> > to ::DBI::ODBC::Microsoft_SQL_Server.pm and set it explicitly in my
> > script.
> >
> > My classes look like => {accessor=>'order_date',data_type =>
> > 'datetime'},
> >
> > If I set the storage type in my script, then call
> > ->ensure_connected, it deletes the key I set:
> >   
> What happens if you call ensure_connected first? The storage type is
> normally determined when the connection is first made, so it figures
> that it is overwritten if you set it before connecting.

Well, it never gets set. Say, since you know that it is determined when
the connection is first made, can you tell me where and how does that
happen? 'Cause it ain't happenin' for me... maybe I can find out why.

# $schema->storage_type('::DBI::ODBC::Microsoft_SQL_Server');

$schema->storage->ensure_connected();
print $schema->storage_type;
print "\n";
 (and in the loop:)

::DBI
::DBI
::DBI
::DBI
::DBI
::DBI
::DBI
::DBI
::DBI
Ducduc: 155392
Can't call method "mdy" on an undefined value at furn_man_check.pl line 45, <DATA> line 42.

No difference at all. Still dies the first time it tries to access it.

Thanks,

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



More information about the DBIx-Class mailing list