[Bast-commits] r7394 - in DBIx-Class/0.08/trunk: lib/DBIx/Class/Storage t

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Wed Aug 26 16:08:25 GMT 2009


Author: ribasushi
Date: 2009-08-26 16:08:24 +0000 (Wed, 26 Aug 2009)
New Revision: 7394

Modified:
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm
   DBIx-Class/0.08/trunk/t/72pg.t
Log:
Make sure sqlt_type gets called after determining driver

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm	2009-08-26 16:07:51 UTC (rev 7393)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm	2009-08-26 16:08:24 UTC (rev 7394)
@@ -2084,8 +2084,17 @@
 
 =cut
 
-sub sqlt_type { shift->_get_dbh->{Driver}->{Name} }
+sub sqlt_type {
+  my ($self) = @_;
 
+  if (not $self->_driver_determined) {
+    $self->_determine_driver;
+    goto $self->can ('sqlt_type');
+  }
+
+  $self->_get_dbh->{Driver}->{Name};
+}
+
 =head2 bind_attribute_by_data_type
 
 Given a datatype from column info, returns a database specific bind

Modified: DBIx-Class/0.08/trunk/t/72pg.t
===================================================================
--- DBIx-Class/0.08/trunk/t/72pg.t	2009-08-26 16:07:51 UTC (rev 7393)
+++ DBIx-Class/0.08/trunk/t/72pg.t	2009-08-26 16:08:24 UTC (rev 7394)
@@ -50,8 +50,15 @@
     unless ($dsn && $user);
 
 DBICTest::Schema->load_classes( 'Casecheck', 'ArrayTest' );
-my $schema = DBICTest::Schema->connect($dsn, $user, $pass,);
 
+{
+  my $schema = DBICTest::Schema->connect($dsn, $user, $pass);
+
+  ok (!$schema->storage->_dbh, 'definitely not connected');
+  is ($schema->storage->sqlt_type, 'PostgreSQL', 'sqlt_type correct pre-connection');
+}
+
+my $schema = DBICTest::Schema->connect($dsn, $user, $pass);
 # Check that datetime_parser returns correctly before we explicitly connect.
 SKIP: {
     eval { require DateTime::Format::Pg };




More information about the Bast-commits mailing list