summaryrefslogtreecommitdiff
path: root/lib/VNDB/DB/Tags.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-03-15 09:16:30 +0100
committerYorhel <git@yorhel.nl>2009-03-15 09:16:30 +0100
commitc748ecd8b5a8b6f4f8898adc9fcfff8d01cf443a (patch)
treea2dcbce55a93d0c73621ffb3cb86041dd2db628a /lib/VNDB/DB/Tags.pm
parentd675229578ef1f9d1633a07bdea8c34312282f45 (diff)
Tag merging
Diffstat (limited to 'lib/VNDB/DB/Tags.pm')
-rw-r--r--lib/VNDB/DB/Tags.pm11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/VNDB/DB/Tags.pm b/lib/VNDB/DB/Tags.pm
index d4e817d7..1368fe10 100644
--- a/lib/VNDB/DB/Tags.pm
+++ b/lib/VNDB/DB/Tags.pm
@@ -5,7 +5,7 @@ use strict;
use warnings;
use Exporter 'import';
-our @EXPORT = qw|dbTagGet dbTagTree dbTagEdit dbTagAdd dbTagDel dbTagLinks dbTagLinkEdit dbTagStats dbTagVNs|;
+our @EXPORT = qw|dbTagGet dbTagTree dbTagEdit dbTagAdd dbTagDel dbTagMerge dbTagLinks dbTagLinkEdit dbTagStats dbTagVNs|;
# %options->{ id noid name search state page results order what }
@@ -112,6 +112,15 @@ sub dbTagDel {
}
+sub dbTagMerge {
+ my($self, $id, @merge) = @_;
+ $self->dbExec('UPDATE tags_vn SET tag = ? WHERE tag IN(!l)', $id, \@merge);
+ $self->dbExec('UPDATE tags_aliases SET tag = ? WHERE tag IN(!l)', $id, \@merge);
+ $self->dbExec('DELETE FROM tags_parents WHERE tag IN(!l)', \@merge);
+ $self->dbExec('DELETE FROM tags WHERE id IN(!l)', \@merge);
+}
+
+
# Directly fetch rows from tags_vn
# Arguments: %options->{ vid uid tag }
sub dbTagLinks {