4 my $dns="DBI:mysql:host=localhost";
5 my $dbh=DBI
->connect($dns, 'root', '') or die "Connect error: $DBI::error";
7 my $table_pattern='_test_db_%';
8 my $sql="SHOW DATABASES LIKE '$table_pattern'";
9 my $sth=$dbh->prepare($sql);
11 my $arrayref=$sth->fetchall_arrayref;
13 print join("\n", map{$_->[0]} @
$arrayref), "\n";
15 for my $db_name (map{$_->[0]} @
$arrayref){
16 $sql="DROP DATABASE $db_name";
24 drop_mysql_biosql_test_dbs
28 In shell command line,
30 drop_mysql_biosql_test_dbs
35 THIS script is for bioperl-db developers to drop all test databases,
36 which may be generated during runing 'make test'.
38 NOTE: This script is only for mysql database, since within my knowledge on
39 DBI, I do not know how to connect to Oracle host without specific database.
40 As well, I do not have Oracle installed. You are welcome to adapt it into
41 Oracle and other RDBMS! :-)
45 Juguang XIAO, juguang at tll.org.sg