Skip to content
Permalink
Browse files

Make sure that we always try a test database.

  • Loading branch information...
perlDreamer committed Jan 13, 2012
1 parent 00e74cb commit 0f22208e3c038c9246b79ca2003d25b00a58ffc1
Showing with 6 additions and 5 deletions.
  1. +6 −5 wre/lib/WRE/Mysql.pm
@@ -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});
};

0 comments on commit 0f22208

Please sign in to comment.
You can’t perform that action at this time.