summaryrefslogtreecommitdiff
path: root/lib/VNDB/DB/Misc.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2008-11-22 09:42:00 +0100
committerYorhel <git@yorhel.nl>2008-11-22 09:42:00 +0100
commitaac83c8b840f62d3febf2212b86bf7cf40eb3fa1 (patch)
tree2168e7f510a68913f8829e0a69a9b401f2cfa7d7 /lib/VNDB/DB/Misc.pm
parent1104001784aa76b9ad8c454336b103d8365cb779 (diff)
Wrote a generic function to handle all /[vrp]+/(lock|hide) URIs
They pretty much all work the same anyway
Diffstat (limited to 'lib/VNDB/DB/Misc.pm')
-rw-r--r--lib/VNDB/DB/Misc.pm14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/VNDB/DB/Misc.pm b/lib/VNDB/DB/Misc.pm
index 6fb82801..d8348e71 100644
--- a/lib/VNDB/DB/Misc.pm
+++ b/lib/VNDB/DB/Misc.pm
@@ -6,7 +6,7 @@ use warnings;
use Exporter 'import';
our @EXPORT = qw|
- dbStats dbRevisionInsert dbItemInsert dbRevisionGet
+ dbStats dbRevisionInsert dbItemInsert dbRevisionGet dbItemMod
|;
@@ -145,5 +145,17 @@ sub dbRevisionGet {
}
+# Lock or hide a DB item
+# arguments: v/r/p, id, %options ->( hidden, locked )
+sub dbItemMod {
+ my($self, $type, $id, %o) = @_;
+ $self->dbExec('UPDATE !s !H WHERE id = ?',
+ {qw|v vn r releases p producers|}->{$type},
+ { map { ($_.' = ?', int $o{$_}) } keys %o }, $id
+ );
+}
+
+
+
1;