projects
/
id3fs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
91cc7c5
)
disable filters again, further tweaks to number_joins
author
Ian Beckwith
<ianb@erislabs.net>
Fri, 22 Oct 2010 15:24:01 +0000
(16:24 +0100)
committer
Ian Beckwith
<ianb@erislabs.net>
Fri, 22 Oct 2010 15:24:01 +0000
(16:24 +0100)
lib/ID3FS/Path.pm
patch
|
blob
|
history
diff --git
a/lib/ID3FS/Path.pm
b/lib/ID3FS/Path.pm
index
855ea9e
..
c800bdb
100644
(file)
--- a/
lib/ID3FS/Path.pm
+++ b/
lib/ID3FS/Path.pm
@@
-30,7
+30,7
@@
our $PATH_ALLTRACKS= "TRACKS";
our $PATH_NOARTIST = "NOARTIST";
our $PATH_NOALBUM = "NOALBUM";
our $PATH_NOARTIST = "NOARTIST";
our $PATH_NOALBUM = "NOALBUM";
-our $ENABLE_FILTER =
1
;
+our $ENABLE_FILTER =
0
;
sub new
{
sub new
{
@@
-358,7
+358,7
@@
sub parse
}
# print "\nELEMENTS: ", join(' ', map { $_->name(); } @elements), "\n";
my @joins=$self->number_joins(@elements);
}
# print "\nELEMENTS: ", join(' ', map { $_->name(); } @elements), "\n";
my @joins=$self->number_joins(@elements);
-
#
@joins=qw(INNER) unless(@joins);
+ @joins=qw(INNER) unless(@joins);
$self->{joins}=\@joins;
# print "AFTER: ", join(' ', map { $_->name() . "(" . $_->{table} . ")"; } @elements), "\n";
# print "JOINS: ", join(', ', @joins), "\n";
$self->{joins}=\@joins;
# print "AFTER: ", join(' ', map { $_->name() . "(" . $_->{table} . ")"; } @elements), "\n";
# print "JOINS: ", join(', ', @joins), "\n";
@@
-372,8
+372,10
@@
sub number_joins
my($self, @elements)=@_;
my @joins=qw(INNER);
my $table=1;
my($self, @elements)=@_;
my @joins=qw(INNER);
my $table=1;
+ my $nextjoin=undef;
my $lastop=undef;
my $lastop=undef;
- return () unless(@elements);
+ return (@joins) unless(@elements);
+ $table++ if(($elements[0]->type() == $TYPE_BOOL) && ($elements[0]->name eq "NOT"));
while(my $thing=shift @elements)
{
if($thing->type() == $TYPE_BOOL)
while(my $thing=shift @elements)
{
if($thing->type() == $TYPE_BOOL)
@@
-381,35
+383,39
@@
sub number_joins
my $op=$thing->name();
if($op eq "AND")
{
my $op=$thing->name();
if($op eq "AND")
{
- $table++;
- push(@joins, "INNER");
+ $nextjoin="INNER";
}
elsif($op eq "NOT")
{
}
elsif($op eq "NOT")
{
- unless($lastop && $lastop eq "AND")
- {
- push(@joins, "LEFT");
- $table++;
- }
+ $nextjoin="LEFT";
}
elsif($op eq "OR")
{
}
elsif($op eq "OR")
{
- if($lastop && $lastop eq "NOT")
- {
- $table++;
- push(@joins, "INNER");
- }
+ $nextjoin="INNER" if($lastop && $lastop eq "NOT");
}
$lastop=$op;
}
else
{
}
$lastop=$op;
}
else
{
- # skip tags with values
- if(@elements && $elements[0]->type() == $TYPE_TAG)
+ # if the expression ends in a tag that has a value
+ # (ie we have the tag and want the value)
+ # use an inner join
+ if(@elements)
{
{
- $thing=shift(@elements);
+ $thing=shift(@elements)
if($elements[0]->type() == $TYPE_TAG)
;
}
}
+ elsif($self->{db}->tag_has_values($thing->id()))
+ {
+ $nextjoin="INNER" if($nextjoin);
+ }
+ $table++ if($nextjoin && $nextjoin eq "INNER");
$thing->table($table);
$thing->table($table);
+ if($nextjoin)
+ {
+ $table++ if($nextjoin eq "LEFT");
+ push(@joins, $nextjoin);
+ $nextjoin=undef;
+ }
}
}
return @joins;
}
}
return @joins;