diff options
author | Yorhel <git@yorhel.nl> | 2010-12-21 10:37:54 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2010-12-21 10:37:54 +0100 |
commit | 19e353c480091ec607324ee09a8821dd3d895975 (patch) | |
tree | 5cf8567f728e5539954d5b2e89ca25bbe4752350 /lib/VNDB/DB/ULists.pm | |
parent | d9aebf063c8ba2b6368418f9b9cab1fbbf241582 (diff) |
Added notes field to the user VN list
The interface to set this could be more dynamic, since it'll be a lot of
work to set different notes for each VN. But oh well, let's first see
how many people will use this feature.
Diffstat (limited to 'lib/VNDB/DB/ULists.pm')
-rw-r--r-- | lib/VNDB/DB/ULists.pm | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/VNDB/DB/ULists.pm b/lib/VNDB/DB/ULists.pm index e6850a02..09cfac23 100644 --- a/lib/VNDB/DB/ULists.pm +++ b/lib/VNDB/DB/ULists.pm @@ -70,7 +70,7 @@ sub dbVNListList { # execute query my($r, $np) = $self->dbPage(\%o, qq| - SELECT vr.vid, vr.title, vr.original, vl.status, COALESCE(vo.vote, 0) AS vote + SELECT vr.vid, vr.title, vr.original, vl.status, vl.notes, COALESCE(vo.vote, 0) AS vote FROM vnlists vl JOIN vn v ON v.id = vl.vid JOIN vn_rev vr ON vr.id = v.latest @@ -119,18 +119,21 @@ sub dbVNListList { } -# Arguments: uid vid status +# Arguments: uid vid status notes # vid can be an arrayref only when the rows are already present, in which case an update is done +# status and notes can be undef when an update is done, in which case these fields aren't updated sub dbVNListAdd { - my($self, $uid, $vid, $stat) = @_; + my($self, $uid, $vid, $stat, $notes) = @_; $self->dbExec( - 'UPDATE vnlists SET status = ? WHERE uid = ? AND vid IN(!l)', - $stat, $uid, ref($vid) ? $vid : [ $vid ] + 'UPDATE vnlists !H WHERE uid = ? AND vid IN(!l)', + {defined($stat) ? ('status = ?' => $stat ):(), + defined($notes)? ('notes = ?' => $notes):()}, + $uid, ref($vid) ? $vid : [ $vid ] ) || $self->dbExec( - 'INSERT INTO vnlists (uid, vid, status) VALUES(?, ?, ?)', - $uid, $vid, $stat + 'INSERT INTO vnlists (uid, vid, status, notes) VALUES(?, ?, ?, ?)', + $uid, $vid, $stat||0, $notes||'' ); } |