]> git.donarmstrong.com Git - infobot.git/blobdiff - src/Misc.pl
factstats author
[infobot.git] / src / Misc.pl
index 027a7a7cf113fcd1c73d4be4fe0f693224807de6..04ace3f0c307e6669a03302a1a32f8af0e3e829b 100644 (file)
@@ -635,8 +635,10 @@ sub closeStats {
 
     foreach (keys %cmdstats) {
        my $type        = $_;
-       my $i   = &dbGet("stats", "counter", "nick=".&dbQuote($type).
-                       " AND type='cmdstats'");
+       my $i   = &sqlSelect("stats", "counter", {
+               nick    => $type,
+               type    => "cmdstats",
+       } );
        my $z   = 0;
        $z++ unless ($i);
 
@@ -649,7 +651,15 @@ sub closeStats {
        );              
        $hash{time} = time() if ($z);
 
-       &dbReplace("stats", "nick", %hash);
+       if (0) {
+           &sqlReplace("stats", %hash);
+       } else {
+           &sqlReplace("stats", {
+               nick            => $type,
+               type            => "cmdstats",
+               -counter        => "counter+1",
+           } );
+       }
     }
 }