From: Rafael Kitover Date: Wed, 3 Mar 2010 15:53:49 +0000 (-0500) Subject: use Storage for getting $dbh (needed for Firebird) X-Git-Tag: 0.06000~69 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c0084472a2f4515cbbd3970773b7d52ff20bcc45;p=dbsrgits%2FDBIx-Class-Schema-Loader.git use Storage for getting $dbh (needed for Firebird) --- diff --git a/t/18firebird_common.t b/t/18firebird_common.t index 62da41c..895874d 100644 --- a/t/18firebird_common.t +++ b/t/18firebird_common.t @@ -32,7 +32,6 @@ my $tester = dbixcsl_common_tests->new( ); }, null => '', - date_datatype => 'TIMESTAMP', dsn => $dsn, user => $user, password => $password, diff --git a/t/lib/dbixcsl_common_tests.pm b/t/lib/dbixcsl_common_tests.pm index 92583bb..3e67dac 100644 --- a/t/lib/dbixcsl_common_tests.pm +++ b/t/lib/dbixcsl_common_tests.pm @@ -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; }