diff options
author | Yorhel <git@yorhel.nl> | 2009-02-28 14:54:56 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2009-02-28 14:54:56 +0100 |
commit | 82a66074209f8cc2e23f9fb738aa869894cb83c9 (patch) | |
tree | 41ca227195e4ffc520509b46ca1e649968843ce3 /lib/VNDB/DB/Tags.pm | |
parent | e3e3f7b3c9556375702703aadb4faa6db695631a (diff) |
Improvements in vntagmod table layout, and saving votes in the DB works
And a "Don't forget to submit" text, and various important bugfixes,
and... geez, time for a coke with some cookies!
Diffstat (limited to 'lib/VNDB/DB/Tags.pm')
-rw-r--r-- | lib/VNDB/DB/Tags.pm | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/VNDB/DB/Tags.pm b/lib/VNDB/DB/Tags.pm index aca87677..2250ff90 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 dbTagEdit dbTagAdd dbTagDel dbTagLinks dbVNTags|; +our @EXPORT = qw|dbTagGet dbTagEdit dbTagAdd dbTagDel dbTagLinks dbTagLinkEdit dbVNTags|; # %options->{ id name search page results order what } @@ -100,6 +100,15 @@ sub dbTagLinks { } +# Change a user's tags for a VN entry +# Arguments: uid, vid, [ [ tag, vote ], .. ] +sub dbTagLinkEdit { + my($self, $uid, $vid, $tags) = @_; + $self->dbExec('DELETE FROM tags_vn WHERE vid = ? AND uid = ?', $vid, $uid); + $self->dbExec('INSERT INTO tags_vn (tag, vid, uid, vote) VALUES (?, ?, ?, ?)', $_->[0], $vid, $uid, $_->[1]) for (@$tags); +} + + # Fetch all tags related to a VN # Argument: vid sub dbVNTags { @@ -114,6 +123,5 @@ sub dbVNTags { ); } - 1; |