From: Ian Beckwith Date: Mon, 4 Oct 2010 03:34:29 +0000 (+0100) Subject: more sql tweaks X-Git-Tag: debian/1.0-1~129 X-Git-Url: http://erislabs.net/gitweb/?p=id3fs.git;a=commitdiff_plain;h=23de00b9fa92c111bce2e40f5e778566d9d90949 more sql tweaks --- diff --git a/lib/ID3FS/DB.pm b/lib/ID3FS/DB.pm index 808ff11..96b88f9 100644 --- a/lib/ID3FS/DB.pm +++ b/lib/ID3FS/DB.pm @@ -207,12 +207,13 @@ sub tags push(@andclauses, "( t2.parents_id=" . (defined($parent) ? $parent : "''") . " )"); if(@tags) { - push(@orclauses, "( t2.parents_id='' AND t2.id NOT IN ( " . join(', ', @tags) ." ) )"); + push(@orclauses, "( t2.id NOT IN ( " . join(', ', @tags) ." ) )"); } for my $pair (@tags_vals) { my($tag, $val)=@$pair; - push(@orclauses, "( NOT (t2.parents_id=$tag AND t2.id=$val ) )"); +# push(@orclauses, "( NOT ( t2.parents_id=$tag AND t2.id=$val ) )"); + push(@andclauses, "( NOT ( t2.id=$tag ) )"); } if(@orclauses) { @@ -402,7 +403,8 @@ sub tags_subselect my @andclauses=(); if(@tags) { - push(@orclauses, "( t1.parents_id='' AND t1.id IN ( " . join(', ', @tags) ." ) )"); + push(@andclauses, "( t1.parents_id=" . (defined($parent) ? $parent : "''") . " )"); + push(@andclauses, "( t1.id IN ( " . join(', ', @tags) ." ) )"); } for my $pair (@tags_vals) {