]> git.donarmstrong.com Git - infobot.git/commitdiff
foo+1 does not work on sqlReplace for sqlite.
authortimriker <timriker@c11ca15a-4712-0410-83d8-924469b57eb5>
Sat, 7 Dec 2002 00:23:13 +0000 (00:23 +0000)
committertimriker <timriker@c11ca15a-4712-0410-83d8-924469b57eb5>
Sat, 7 Dec 2002 00:23:13 +0000 (00:23 +0000)
odd thing is that is does work on sqlUpdate.
avoid it when it's easy.

git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@735 c11ca15a-4712-0410-83d8-924469b57eb5

src/Factoids/Question.pl
src/IRC/IrcHooks.pl
src/Misc.pl
src/Process.pl

index 74a24163e30f17f2df6072c1b66278bd59bb5047..7d6f27cb94b36371ed94496c3c16ed361ce64ea9 100644 (file)
@@ -246,19 +246,11 @@ sub factoidArgs {
        }
 
        # update stats.
-       if (0) {        # old.
-           my $count = &getFactInfo($q, "requested_count") || 0;
-           $count++;
-           &setFactInfo($q, "requested_by", $nuh);
-           &setFactInfo($q, "requested_time", time());
-           &setFactInfo($q, "requested_count", $count);
-       } else {
-           &sqlUpdate("factoids", { factoid_key => $q }, {
-               requested_by            => $nuh,
-               requested_time          => time(),
-               -requested_count        => "requested_count+1",
-           } );
-       }
+       &sqlUpdate("factoids", { factoid_key => $q }, {
+           requested_by        => $nuh,
+           requested_time      => time(),
+           -requested_count    => "requested_count+1",
+       } );
 
        # end of update stats.
 
index b63c4056c3887cd55a35ec0785eb3030b8314c89..e8c4efa001bb74156ec8ea511e1123b1f406176a 100644 (file)
@@ -893,24 +893,13 @@ sub on_public {
            next unless (defined $t);
            next unless ($time - $t > 10);
 
-           my %hash = (
-               nick    => $who,
-               type    => $x,
+           &sqlReplace("stats", {
+               nick => $who,
+               type => $x,
                channel => $c,
-
                time    => $time,
                counter => $v,
-           );
-               
-           if (0) {
-               &sqlReplace("stats", \%hash);
-           } else {
-               &sqlReplace("stats", {
-                       nick => $who,
-                       type => $x,
-                       -counter => "counter+1",
-               } );
-           }
+           } );
        }
     }
 
index 04ace3f0c307e6669a03302a1a32f8af0e3e829b..1965db20513723dc3d963982d9ea54325bd110d4 100644 (file)
@@ -644,22 +644,13 @@ sub closeStats {
 
        $i      += $cmdstats{$type};
 
-       my %hash = (
-               nick => $type,
-               type => "cmdstats",
-               counter => $i
-       );              
-       $hash{time} = time() if ($z);
-
-       if (0) {
-           &sqlReplace("stats", %hash);
-       } else {
-           &sqlReplace("stats", {
-               nick            => $type,
-               type            => "cmdstats",
-               -counter        => "counter+1",
-           } );
-       }
+
+       &sqlReplace("stats", {
+           nick        => $type,
+           type        => "cmdstats",
+           'time'      => time(),
+           counter     => $i,
+       } );
     }
 }
 
index 22ab7a845541403e175ff389e86f0b6a000eb522..3563866c101790061fd01d4750c9124dab7e2e09 100644 (file)
@@ -322,11 +322,12 @@ sub process {
            $karma--;
        }
 
-       &sqlSet("stats", 
-               { nick => $term, type => "karma" },     # WHERE
-#              { counter => $karma }                   # WHAT
-               { -counter => "counter+1" }
-       );
+       &sqlReplace("stats", {
+           nick        => $term,
+           type        => "karma",
+           'time'      => time(),
+           counter     => $karma,
+       } );
 
        return;
     }