]> git.donarmstrong.com Git - infobot.git/blobdiff - src/dbm.pl
dbDel takes a hash, dbm untested
[infobot.git] / src / dbm.pl
index 63e6c81005c24dfa675759743aab3c6bdaeee1f0..eb66aa96c7a5e519e0a749c2a7fa113f52afea9a 100644 (file)
@@ -230,10 +230,12 @@ sub dbSetRow {
 }
 
 #####
-# Usage: &dbDel($table, $primkey, $primval, [$key]);
+# Usage: &dbDel($table, $primhash_ref);
+#  Note: dbDel does dbQuote
 sub dbDel {
-    my ($table, $primkey, $primval, $key) = @_;
-    &DEBUG("dbDel($table, $primkey, $primval);");
+    my ($table, $phref) = @_;
+    # FIXME does not really handle more than one key!
+    my $primval = join(':', values %{$phref});
 
     if (!defined ${$table}{lc $primval}) {
        &DEBUG("dbDel: lc $primval does not exist in $table.");
@@ -251,7 +253,7 @@ sub dbReplace {
     my ($table, $key, %hash) = @_;
     &DEBUG("dbReplace($table, $key, %hash);");
 
-    &dbDel($table, $key, $hash{$key}, %hash);
+    &dbDel($table, {$key=>$hash{$key}});
     &dbInsert($table, $hash{$key}, %hash);
     return 1;
 }