Assuming (from your example) that you are talking about MySQL, there are two ways:
# easy $db->do("DROP DATABASE IF EXISTS nikos_db"); # difficult my $dbs = $db->selectcol_arrayref("show databases") or die("can't get the db list\n"); if (grep {$_ eq 'nikos_db'} @$dbs) { $db->do("DROP DATABASE nikos_db"); }
In reply to Re: how to know if a databse exists before i delete it?
by Caron
in thread how to know if a databse exists before i delete it?
by Nik
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |