From: timriker Date: Fri, 6 Dec 2002 20:30:28 +0000 (+0000) Subject: factstats author X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=d3b9443406eb3916fc9e57718af7690f58e2854e;p=infobot.git factstats author git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@729 c11ca15a-4712-0410-83d8-924469b57eb5 --- diff --git a/src/Modules/Factoids.pl b/src/Modules/Factoids.pl index 729ec8e..7a9a178 100644 --- a/src/Modules/Factoids.pl +++ b/src/Modules/Factoids.pl @@ -136,14 +136,14 @@ sub CmdFactStats { my ($type) = @_; if ($type =~ /^author$/i) { - my @array = &sqlSelectColArray("factoids", + my %hash = &sqlSelectColHash("factoids", "factoid_key,created_by", { }, "created_by IS NOT NULL" ); my %author; - foreach (@array) { - my $thisnuh = $hash{$_}; + foreach my $factoid (keys %hash) { + my $thisnuh = $hash{$factoid}; $thisnuh =~ /^(\S+)!\S+@\S+$/; $author{lc $1}++; diff --git a/src/dbi.pl b/src/dbi.pl index e0f48c4..f10845a 100644 --- a/src/dbi.pl +++ b/src/dbi.pl @@ -88,9 +88,10 @@ sub sqlSelectMany { return; } + $query .= " WHERE " if (($where_href) || ($other)); if ($where_href) { my $where = &hashref2where($where_href); - $query .= " WHERE $where" if ($where); + $query .= "$where" if ($where); } $query .= " $other" if $other;