]> git.donarmstrong.com Git - infobot.git/blobdiff - src/db_mysql.pl
fixed the following bugs:
[infobot.git] / src / db_mysql.pl
index a88051cf96223a8006f22ef4496c848c6950e72f..754bcdab70513de474e122caec07c0e1f1fb0fdf 100644 (file)
@@ -186,9 +186,9 @@ sub dbInsert {
 }
 
 #####
-# Usage: &dbReplace($table, $primkey, %hash);
+# Usage: &dbReplace($table, $primkey, $primval, %hash);
 sub dbReplace {
-    my ($table, $primkey, %hash) = @_;
+    my ($table, $primkey, $primval, %hash) = @_;
     my (@keys, @vals);
 
     foreach (keys %hash) {
@@ -198,7 +198,8 @@ sub dbReplace {
     }
 
     &dbRaw("Replace($table)", "REPLACE INTO $table (".join(',',@keys).
-               ") VALUES (".join(',',@vals).")"
+               ") VALUES (".join(',',@vals).") WHERE $primkey=".
+               &dbQuote($primval)
     );
 
     return 1;
@@ -242,7 +243,7 @@ sub dbRaw {
     &SQLDebug($query);
     if (!$sth->execute) {
        &ERROR("Raw($prefix): => '$query'");
-       &ERROR("Raw($prefix): $DBI::errstr");
+#      &ERROR("Raw($prefix): $DBI::errstr");
        $sth->finish;
        return 0;
     }