Skip to content

Commit

Permalink
Make sure that we always try a test database.
Browse files Browse the repository at this point in the history
  • Loading branch information
perlDreamer committed Jan 13, 2012
1 parent 00e74cb commit 0f22208
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions wre/lib/WRE/Mysql.pm
Expand Up @@ -82,13 +82,14 @@ A dsn to connect with. By default uses the DSN for the test database.
=cut

sub getDatabaseHandle {
my $self = shift;
my %options = @_;
my $self = shift;
my %options = @_;
my $password = $options{password};
my $mysql = $self->wreConfig->get("mysql");
my $mysql = $self->wreConfig->get("mysql");
my $username = $options{username} || $mysql->{adminUser};
my $dsn = $options{dsn} || 'DBI:mysql:'.$mysql->{test}->{database}.';host='.$mysql->{hostname}.';port='.$mysql->{port};
my $db = undef;
my $test_db = $mysql->{test}->{database} || 'test';
my $dsn = $options{dsn} || 'DBI:mysql:'.$test_db.';host='.$mysql->{hostname}.';port='.$mysql->{port};
my $db = undef;
eval {
$db = DBI->connect($dsn, $username, $password, {RaiseError=>1});
};
Expand Down

0 comments on commit 0f22208

Please sign in to comment.