X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scripts%2Fmysql2txt.pl;h=b733e7625d7646d67bf3d5854522d93cbb8de775;hb=e4a9397b50848fd83f084324176e2afbaeaa241f;hp=c1a2c9364a34f5c01b4cfebc5c59873a4bf45469;hpb=f0a00b56d1497c3b3f0d33e0d57e5d31a0161a55;p=infobot.git diff --git a/scripts/mysql2txt.pl b/scripts/mysql2txt.pl index c1a2c93..b733e76 100755 --- a/scripts/mysql2txt.pl +++ b/scripts/mysql2txt.pl @@ -11,37 +11,39 @@ require "src/Files.pl"; $bot_src_dir = "./src/"; my $dbname = shift; -if (!defined $dbname) { +if ( !defined $dbname ) { print "Usage: $0 \n"; print "Example: $0 factoids\n"; exit 0; } # open the db. -&loadConfig("files/blootbot.config"); +&loadConfig("files/infobot.config"); &loadDBModules(); -&openDB(); +&openDB( $param{'DBName'}, $param{'SQLUser'}, $param{'SQLPass'} ); # retrieve a list of db's from the server. my %db; -foreach ($dbh->func('_ListTables')) { +foreach ( $dbh->func('_ListTables') ) { $db{$_} = 1; } # factoid db. -if (!exists $db{$dbname}) { +if ( !exists $db{$dbname} ) { print "error: $dbname does not exist as a table.\n"; exit 1; } my $query = "SELECT factoid_key,factoid_value from $param{'DBName'}.$dbname"; -my $sth = $dbh->prepare($query); +my $sth = $dbh->prepare($query); $sth->execute; -while (my @row = $sth->fetchrow_array) { - print "$row[0] => $row[1]\n"; +while ( my @row = $sth->fetchrow_array ) { + print "$row[0] => $row[1]\n"; } $sth->finish; print "Done.\n"; &closeDB(); + +# vim:ts=4:sw=4:expandtab:tw=80