Change the dbname/dbport/dbhost parameters into one dsn parameter.

This commit is contained in:
Andrew McMillan 2007-11-02 22:12:45 +13:00
parent b876c2ef54
commit c370e3dc5f

View File

@ -10,11 +10,9 @@ use Getopt::Long qw(:config permute); # allow mixed args.
# Options variables # Options variables
my $debug = 0; my $debug = 0;
my $dbname = "rscds"; my $dsn = "davical";
my $dbport = 5432;
my $dbuser = ""; my $dbuser = "";
my $dbpass = ""; my $dbpass = "";
my $dbhost = "";
my $suite; my $suite;
my $test; my $test;
my $helpmeplease = 0; my $helpmeplease = 0;
@ -25,11 +23,9 @@ my $patchdir = $dbadir . "/patches";
GetOptions ('debug!' => \$debug, GetOptions ('debug!' => \$debug,
'dbname=s' => \$dbname, 'dsn=s' => \$dsn,
'dbuser=s' => \$dbuser, 'dbuser=s' => \$dbuser,
'dbpass=s' => \$dbpass, 'dbpass=s' => \$dbpass,
'dbport=s' => \$dbport,
'dbhost=s' => \$dbhost,
'suite=s' => \$suite, 'suite=s' => \$suite,
'case=s' => \$test, 'case=s' => \$test,
'help' => \$helpmeplease ); 'help' => \$helpmeplease );
@ -40,10 +36,8 @@ usage() if ( $helpmeplease || !defined($suite) || !defined($test));
# Open database connection. Note that the standard PostgreSQL # Open database connection. Note that the standard PostgreSQL
# environment variables will also work with DBD::Pg. # environment variables will also work with DBD::Pg.
############################################################ ############################################################
my $dsn = "dbi:Pg:dbname=$dbname"; $dsn = "dbi:Pg:dbname=$dsn";
$dsn .= ";host=$dbhost" if ( "$dbhost" ne "" ); my $dbh = DBI->connect($dsn, $dbuser, $dbpass, { AutoCommit => 0 } ) or die "Can't connect to database $dsn";
$dsn .= ";port=$dbport" if ( $dbport != 5432 );
my $dbh = DBI->connect($dsn, $dbuser, $dbpass, { AutoCommit => 0 } ) or die "Can't connect to database $dbname";
my @arguments = ( "--basic", "--proxy", "", "--silent" ); my @arguments = ( "--basic", "--proxy", "", "--silent" );
@ -242,11 +236,9 @@ and follow the instructions there.
The following options are available for controlling the database, for The following options are available for controlling the database, for
those test cases which might require it: those test cases which might require it:
--dbname <database> --dsn <database>[;port=NNNN][;host=example.com]
--dbuser <user> --dbuser <user>
--dbpass <password> --dbpass <password>
--dbport <port>
--dbhost <host>
The test instructions will include lines defining the test like: The test instructions will include lines defining the test like: