From: dave%intrec.com <> Date: Wed, 23 Aug 2000 01:30:05 +0000 (+0000) Subject: Fix for bug 16454: can now run checksetup.pl on databases with passwords. X-Git-Tag: bugzilla-2.12~204 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=24ba85e278db6a0d7029af8a0408485ce33553d6;p=thirdparty%2Fbugzilla.git Fix for bug 16454: can now run checksetup.pl on databases with passwords. --- diff --git a/checksetup.pl b/checksetup.pl index fa575b1c23..f3371b977d 100755 --- a/checksetup.pl +++ b/checksetup.pl @@ -502,10 +502,12 @@ my $drh = DBI->install_driver($db_base) if ($db_check) { # Do we have the database itself? - my @databases = $drh->func($db_host, $db_port, '_ListDBs'); + my $dsn = "DBI:$db_base:$db_name;$db_host;$db_port"; + my $dbh = DBI->connect($dsn, $db_user, $db_pass); + my @databases = $dbh->func('_ListDBs'); unless (grep /^$db_name$/, @databases) { - print "Creating database $db_name ...\n"; - $drh->func('createdb', $db_name, 'admin') + print "Creating database $db_name ...\n"; + $drh->func('createdb', $db_name, "$db_host:$db_port", $db_user, $db_pass, 'admin') or die <<"EOF" The '$db_name' database is not accessible. This might have several reasons: @@ -518,6 +520,7 @@ The '$db_name' database is not accessible. This might have several reasons: '\$db_check' to zero.\n EOF } + $dbh->disconnect if $dbh; } # now get a handle to the database: