Show
Ignore:
Timestamp:
04/13/08 04:41:46 (20 months ago)
Author:
bchoate
Message:

Applied patches from Ogawa-san to add an optimized 'exist' method for testing for existing rows. BugId:69661

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release-34/lib/MT/Tag.pm

    r1657 r1873  
    9595        if (!$tag->n8d_id) { 
    9696            # normalized tag! we can't delete if others reference us 
    97             my $child_tags = MT::Tag->count({n8d_id => $tag->id}); 
     97            my $child_tags = MT::Tag->exist({n8d_id => $tag->id}); 
    9898            return $tag->error(MT->translate("This tag is referenced by others.")) 
    9999                if $child_tags; 
     
    108108    if ($n8d_tag) { 
    109109        # Normalized tag, no longer referenced by other tags... 
    110         if (!MT::Tag->count({n8d_id => $n8d_tag->id})) { 
     110        if (!MT::Tag->exist({n8d_id => $n8d_tag->id})) { 
    111111            # Noramlized tag that no longer has any object tag associations 
    112112            require MT::ObjectTag; 
    113             if (!MT::ObjectTag->count({tag_id => $n8d_tag->id})) { 
     113            if (!MT::ObjectTag->exist({tag_id => $n8d_tag->id})) { 
    114114                $n8d_tag->remove 
    115115                    or return $tag->error($n8d_tag->errstr); 
     
    412412        my $this_tag_id = $otag->tag_id; 
    413413        $otag->remove; 
    414         if (! MT::ObjectTag->count({tag_id => $this_tag_id})) { 
     414        if (! MT::ObjectTag->exist({tag_id => $this_tag_id})) { 
    415415            # no more references to this tag... just delete it now 
    416416            if (my $tag = MT::Tag->load($this_tag_id)) {