use Storage for getting $dbh (needed for Firebird)
Rafael Kitover [Wed, 3 Mar 2010 15:53:49 +0000 (10:53 -0500)]
t/18firebird_common.t
t/lib/dbixcsl_common_tests.pm

index 62da41c..895874d 100644 (file)
@@ -32,7 +32,6 @@ my $tester = dbixcsl_common_tests->new(
         );
     },
     null        => '',
-    date_datatype => 'TIMESTAMP',
     dsn         => $dsn,
     user        => $user,
     password    => $password,
index 92583bb..3e67dac 100644 (file)
@@ -832,17 +832,25 @@ sub check_no_duplicate_unique_constraints {
 sub dbconnect {
     my ($self, $complain) = @_;
 
-    my $dbh = DBI->connect(
-         $self->{dsn}, $self->{user},
-         $self->{password},
-         {
-             RaiseError => $complain,
-             PrintError => $complain,
-             AutoCommit => 1,
-         }
-    );
+    require DBIx::Class::Storage::DBI;
+    my $storage = DBIx::Class::Storage::DBI->new;
+
+    $complain = defined $complain ? $complain : 1;
+
+    $storage->connect_info([
+        @{ $self }{qw/dsn user password/},
+        {
+            unsafe => 1,
+            RaiseError => $complain,
+            ShowErrorStatement => $complain,
+            PrintError => 0,
+        },
+    ]);
+
+    my $dbh = eval { $storage->dbh };
+    die "Failed to connect to database: $@" if !$dbh;
 
-    die "Failed to connect to database: $DBI::errstr" if !$dbh;
+    $self->{storage} = $storage; # storage DESTROY disconnects
 
     return $dbh;
 }