X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scripts%2Fmysql2txt.pl;h=b733e7625d7646d67bf3d5854522d93cbb8de775;hb=0b8cc0cae8719a4a06ee34ec6bd99f911efc1d9c;hp=2973610f092ccb9d84e64a5cd3df584a7a1f5b1e;hpb=1c0a2202fe58159dd4d4197c4ff8b21f9387685e;p=infobot.git diff --git a/scripts/mysql2txt.pl b/scripts/mysql2txt.pl index 2973610..b733e76 100755 --- a/scripts/mysql2txt.pl +++ b/scripts/mysql2txt.pl @@ -11,7 +11,7 @@ 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; @@ -21,27 +21,29 @@ if (!defined $dbname) { &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