From 718f4d0258049aa92f229c08d5ec7204dae3ffa6 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Sat, 17 Oct 2015 17:05:50 +0200 Subject: SQL: Fix all browsing queries to use the new schema This basically makes VNDB browsable again, but editing entries is still broken. I split off the get-old-revision functionality from the db*Get() methods into db*GetRev(). This split makes sense even with the old SQL schema: db*Get() had to special-case some joins/filters when fetching an older revision, and none of the other filters would work in that case. This split does cause some code duplication in that all db*GetRev() methods look very much alike, and that the columns they fetch is almost identical to the db*Get() methods. Not sure yet how to avoid the duplication elegantly. I didn't do a whole lot of query optimization yet (most issues require extra indices, I'll investigate later which indices will make a big difference), but I did fix some low hanging fruit whenever I encountered something. I don't think I've worsened anything, performance-wise. --- lib/VNDB/Handler/Misc.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/VNDB/Handler/Misc.pm') diff --git a/lib/VNDB/Handler/Misc.pm b/lib/VNDB/Handler/Misc.pm index 8176d854..c32766b1 100644 --- a/lib/VNDB/Handler/Misc.pm +++ b/lib/VNDB/Handler/Misc.pm @@ -75,7 +75,7 @@ sub homepage { for (@$changes) { li; lit mt '_home_recentchanges_item', $_->{type}, - sprintf('%s', "/$_->{type}$_->{iid}.$_->{rev}", + sprintf('%s', "/$_->{type}$_->{itemid}.$_->{rev}", xml_escape($_->{ioriginal}||$_->{ititle}), xml_escape shorten $_->{ititle}, 33), $_; end; @@ -214,7 +214,7 @@ sub history { # get the edit history my($list, $np) = $self->dbRevisionGet( what => 'item user', - $type && $type ne 'u' ? ( type => $type, iid => $id ) : (), + $type && $type ne 'u' ? ( type => $type, itemid => $id ) : (), $type eq 'u' ? ( uid => $id ) : (), $f->{t} ? ( type => $f->{t} eq 'a' ? [qw|v r p|] : $f->{t} ) : (), page => $f->{p}, -- cgit v1.2.3