X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scripts%2Fmysql2txt.pl;h=b733e7625d7646d67bf3d5854522d93cbb8de775;hb=3536c5564f248374a76fa5eda24f4b9c5b2c54c1;hp=53f3b7763f29247fbdc3f4f057702cb49e6950b8;hpb=4948d015422203bf3a4e913f5e3e90c374cfa58e;p=infobot.git diff --git a/scripts/mysql2txt.pl b/scripts/mysql2txt.pl index 53f3b77..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($param{'DBName'}, $param{'SQLUser'}, $param{'SQLPass'}); +&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