Subject: | cygwin test patch + SQLite support |
Attached is a patch to fix a socket issue on cygwin with mysql.
cygwin needs 127.0.0.1 as HOST in the dsn, the default localhost is wrong.
An optional HOST=localhost may be added to make test
Also added SQLite to the supported drivers. It runs out of the box,
e.g. with:
make test DRIVER=SQLite
--- Tie-DBI-0.91/t/DBI.t~ 2000-03-23 03:49:20.000000000 +0100
+++ Tie-DBI-0.91/t/DBI.t 2003-09-02 12:00:41.000000000 +0200
@@ -12,6 +12,7 @@
use constant USER => $ENV{USER};
use constant PASS => $ENV{PASS};
use constant DBNAME => $ENV{DB} || 'test';
+use constant HOST => $ENV{HOST} || ($^O eq 'cygwin') ? '127.0.0.1' : 'localhost';
BEGIN { $| = 1; print "1..32\n"; }
END {print "not ok 1\n" unless $loaded;}
@@ -26,7 +27,7 @@
local($^W)=0; # kill uninitialized variable warning
# I like mysql best, followed by Oracle and Sybase
my ($count) = 0;
- my (%DRIVERS) = map { ($_,$count++) } qw(Informix Pg Ingres mSQL Sybase Oracle mysql); # ExampleP doesn't work;
+ my (%DRIVERS) = map { ($_,$count++) } qw(Informix Pg Ingres mSQL Sybase Oracle mysql SQLite); # ExampleP doesn't work;
($DRIVER) = sort { $DRIVERS{$b}<=>$DRIVERS{$a} } DBI->available_drivers(1);
}
@@ -93,7 +94,7 @@
sub initialize_database {
local($^W) = 0;
- my $dsn = "dbi:$DRIVER:${\DBNAME}";
+ my $dsn = "dbi:$DRIVER:${\DBNAME}:${\HOST}";
my $dbh = DBI->connect($dsn,USER,PASS,{Warn=>1,PrintError=>1,ChopBlanks=>1}) || return undef;
$dbh->do("DROP TABLE testTie");
return $dbh if $DRIVER eq 'ExampleP';
--- Tie-DBI-0.91/t/RDBM.t~ 2000-03-23 03:49:20.000000000 +0100
+++ Tie-DBI-0.91/t/RDBM.t 2003-09-02 12:01:30.000000000 +0200
@@ -12,6 +12,7 @@
use constant USER => $ENV{USER};
use constant PASS => $ENV{PASS};
use constant DBNAME => $ENV{DB} || 'test';
+use constant HOST => $ENV{HOST} || ($^O eq 'cygwin') ? '127.0.0.1' : 'localhost';
BEGIN { $| = 1; print "1..20\n"; }
END {print "not ok 1\n" unless $loaded;}
@@ -32,7 +33,7 @@
local($^W)=0; # kill uninitialized variable warning
# Test using the mysql, sybase, oracle and mSQL databases respectively
my ($count) = 0;
- my (%DRIVERS) = map { ($_,$count++) } qw(Informix Pg Ingres mSQL Sybase Oracle mysql); # ExampleP doesn't work
+ my (%DRIVERS) = map { ($_,$count++) } qw(Informix Pg Ingres mSQL Sybase Oracle mysql SQLite); # ExampleP doesn't work
($DRIVER) = sort { $DRIVERS{$b}<=>$DRIVERS{$a} } DBI->available_drivers(1);
}
@@ -42,7 +43,7 @@
die "Found no DBD driver to use.\n";
}
-my($dsn) = "dbi:$DRIVER:${\DBNAME}";
+my $dsn = "dbi:$DRIVER:${\DBNAME}:${\HOST}";
print "ok 1\n";
test 2,tie %h,Tie::RDBM,$dsn,{create=>1,drop=>1,table=>'PData','warn'=>0,user=>USER,password=>PASS};
%h=();
--- Tie-DBI-0.91/README~ 2000-03-23 03:49:17.000000000 +0100
+++ Tie-DBI-0.91/README 2003-09-02 12:00:27.000000000 +0200
@@ -45,9 +45,9 @@
If you need to specify a different database, or need to provide a
username and password to log in, you can provide these values as DB,
-USER and PASS, respectively, as in:
+USER, PASS and HOST, respectively, as in:
- make test DRIVER=Oracle DB=DEMO USER=fred PASS=xyzzy
+ make test DRIVER=Oracle DB=DEMO USER=fred PASS=xyzzy HOST=localhost
And some drivers, such as Pg, want funny database names, as in:
@@ -77,6 +77,7 @@
7) DBD::Sybase (partial, croaks on each())
8) DBD::Solid
9) DBD::ODBC (on mysql ODBC driver)
+ 10) DBD::SQLite
Microsoft SQL server works partially with Tie::DBI (everything but
"each") and not at all with Tie::RDBM. This is because SQL server