madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[livejournal] r21598: LJSV-2137: DB error when try to delete 0...

Committer: sbelyaev
LJSV-2137: DB error when try to delete 0 tags
U   trunk/cgi-bin/LJ/Support/Request/Tag.pm
Modified: trunk/cgi-bin/LJ/Support/Request/Tag.pm
===================================================================
--- trunk/cgi-bin/LJ/Support/Request/Tag.pm	2012-03-29 15:07:10 UTC (rev 21597)
+++ trunk/cgi-bin/LJ/Support/Request/Tag.pm	2012-03-29 15:16:37 UTC (rev 21598)
@@ -523,7 +523,9 @@
     my $dbh = LJ::get_db_writer();
 
     my $sptagids_cond;
-    if ($spcatids) {
+    if ($spcatids && @sptagids) {
+        warn LJ::D(@sptagids);
+
         my @spcatids = map { $_ + 0 } @$spcatids;
         my $spcatids_cond = join(',', @spcatids);
 
@@ -532,11 +534,11 @@
             "SELECT sptagid FROM supporttag WHERE ".
             "sptagid IN ($sptagids_cond) AND spcatid IN ($spcatids_cond)"
         )};
+
+        $sptagids_cond = join(',', @sptagids);
+        $dbh->do("DELETE FROM supporttag WHERE sptagid IN ($sptagids_cond)");
+        $dbh->do("DELETE FROM supporttagmap WHERE sptagid IN ($sptagids_cond)");
     }
-
-    $sptagids_cond = join(',', @sptagids);
-    $dbh->do("DELETE FROM supporttag WHERE sptagid IN ($sptagids_cond)");
-    $dbh->do("DELETE FROM supporttagmap WHERE sptagid IN ($sptagids_cond)");
 }
 
 1;

Tags: livejournal, madeon, pm, sbelyaev
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