Revision history for DBIx::Class
+ - rebless before building datetime_parser
+ (patch from mattlaw / Matt Lawrence)
+
0.08003 2007-07-14 18:01:00
- improved populate bulk_insert mode
- fixed up multi_create to be more intelligent about PK<->PK rels
sub datetime_parser {
my $self = shift;
- return $self->{datetime_parser} ||= $self->build_datetime_parser(@_);
+ return $self->{datetime_parser} ||= do {
+ $self->ensure_connected;
+ $self->build_datetime_parser(@_);
+ };
}
=head2 datetime_parser_type
plan skip_all => 'Set $ENV{DBICTEST_PG_DSN}, _USER and _PASS to run this test'
. ' (note: creates and drops tables named artist and casecheck!)' unless ($dsn && $user);
-plan tests => 8;
+plan tests => 10;
DBICTest::Schema->load_classes( 'Casecheck' );
my $schema = DBICTest::Schema->connect($dsn, $user, $pass);
+# Check that datetime_parser returns correctly before we explicitly connect.
+SKIP: {
+ eval { require DateTime::Format::Pg };
+ skip "DateTime::Format::Pg required", 2 if $@;
+
+ my $store = ref $schema->storage;
+ is($store, 'DBIx::Class::Storage::DBI', 'Started with generic storage');
+
+ my $parser = $schema->storage->datetime_parser;
+ is( $parser, 'DateTime::Format::Pg', 'datetime_parser is as expected');
+}
+
my $dbh = $schema->storage->dbh;
$schema->source("Artist")->name("testschema.artist");
$dbh->do("CREATE SCHEMA testschema;");