wisest owl (wisest_owl) wrote in changelog,
wisest owl
wisest_owl
changelog

[livejournal] r17698: LJSUP-7359. error when deleted vertical

Committer: gprochaev
LJSUP-7359. error when deleted vertical

U   trunk/cgi-bin/LJ/Vertical.pm
Modified: trunk/cgi-bin/LJ/Vertical.pm
===================================================================
--- trunk/cgi-bin/LJ/Vertical.pm	2010-11-16 09:15:25 UTC (rev 17697)
+++ trunk/cgi-bin/LJ/Vertical.pm	2010-11-16 09:34:19 UTC (rev 17698)
@@ -346,11 +346,14 @@
 
 sub get_categories {
     my $self = shift;
+    my $cat  = shift;
 
     my $dbh = LJ::get_db_reader();
 
-    my $cats = $dbh->selectall_arrayref("SELECT * FROM category WHERE vert_id = ?", { Slice => {} }, $self->vert_id);
+    my $where = $cat ? " AND parentcatid = " . $cat->catid : "";
 
+    my $cats = $dbh->selectall_arrayref("SELECT * FROM category WHERE vert_id = ? $where", { Slice => {} }, $self->vert_id);
+
     return $cats;
 }
 
@@ -1072,7 +1075,8 @@
         or die "unable to contact global db master to load vertical";
 
     my $res = $dbh->do("SELECT vert_id FROM category WHERE vert_id = ?", undef, $self->{vert_id});
-    return $res if $res;
+    return $res 
+        unless $res eq '0E0'; ## 0E0 means executed ok with 0 rows fetched.
 
     foreach my $table (qw(vertical2)) {# vertical_entries)) {
         $dbh->do("DELETE FROM $table WHERE vert_id=?", undef, $self->{vert_id});

Tags: livejournal, pm, wisest-owl
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments