X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=t%2Fdb_colinfo.t;h=c56fbf28497b2b954345059a1d6816474574885d;hb=745badbb1417451398a0f983c450fd8725794f65;hp=4a4846a3f2df51a40d99650c2cdd61fb578e9f03;hpb=1abc072646e8d37a20ee85c8ca6bb548e2176027;p=maypole.git diff --git a/t/db_colinfo.t b/t/db_colinfo.t index 4a4846a..c56fbf2 100755 --- a/t/db_colinfo.t +++ b/t/db_colinfo.t @@ -88,24 +88,28 @@ package main; $DB_Class = 'BeerDB::BeerTestmysql'; -my $drh = DBI->install_driver("mysql"); -my %databases = map { $_ => 1 } $drh->func('localhost', 3306, '_ListDBs'); +my $drh = eval { DBI->install_driver("mysql"); }; +$err = $@; +if ($err) { + $skip_msg = "no driver for MySQL"; +} else { + my %databases = map { $_ => 1 } $drh->func('localhost', 3306, '_ListDBs'); -unless ($databases{test}) { - my $rc = $drh->func("createdb", 'test', 'admin'); -} + unless ($databases{test}) { + my $rc = $drh->func("createdb", 'test', 'admin'); + } -%databases = map { $_ => 1 } $drh->func('localhost', 3306, '_ListDBs'); + %databases = map { $_ => 1 } $drh->func('localhost', 3306, '_ListDBs'); -if ($databases{test}) { - eval {$DB_Class->connection("dbi:mysql:$db", "$dbuser", "$dbpasswd"); }; - $err = $@; - $skip_msg = "Could not connect to MySQL using database 'test', username 'test', and password ''. Check privileges and try again."; -} else { - $err = 'no test db'; - $skip_msg = "Could not connect to MySQL using database 'test' as it doesn't exist, sorry"; + if ($databases{test}) { + eval {$DB_Class->connection("dbi:mysql:$db", "$dbuser", "$dbpasswd"); }; + $err = $@; + $skip_msg = "Could not connect to MySQL using database 'test', username 'test', and password ''. Check privileges and try again."; + } else { + $err = 'no test db'; + $skip_msg = "Could not connect to MySQL using database 'test' as it doesn't exist, sorry"; + } } - $skip_howmany = 22; SKIP: { @@ -149,7 +153,6 @@ SKIP: { skip $skip_msg, $skip_howmany if $err; $DB_Class->table($table); #use Data::Dumper; -#warn "colinfo is " . Dumper($DB_Class->_column_info()); run_method_tests($DB_Class,'column_type', %correct_types); # No support default #run_method_tests($DB_Class,'column_default', %correct_defaults);