Skip to content

Commit 0f22208

Browse files
committedJan 13, 2012
Make sure that we always try a test database.
1 parent 00e74cb commit 0f22208

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed
 

‎wre/lib/WRE/Mysql.pm

+6-5
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,14 @@ A dsn to connect with. By default uses the DSN for the test database.
8282
=cut
8383

8484
sub getDatabaseHandle {
85-
my $self = shift;
86-
my %options = @_;
85+
my $self = shift;
86+
my %options = @_;
8787
my $password = $options{password};
88-
my $mysql = $self->wreConfig->get("mysql");
88+
my $mysql = $self->wreConfig->get("mysql");
8989
my $username = $options{username} || $mysql->{adminUser};
90-
my $dsn = $options{dsn} || 'DBI:mysql:'.$mysql->{test}->{database}.';host='.$mysql->{hostname}.';port='.$mysql->{port};
91-
my $db = undef;
90+
my $test_db = $mysql->{test}->{database} || 'test';
91+
my $dsn = $options{dsn} || 'DBI:mysql:'.$test_db.';host='.$mysql->{hostname}.';port='.$mysql->{port};
92+
my $db = undef;
9293
eval {
9394
$db = DBI->connect($dsn, $username, $password, {RaiseError=>1});
9495
};

0 commit comments

Comments
 (0)