projects
/
id3fs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
53a3293
)
tweak number_joins
author
Ian Beckwith
<ianb@erislabs.net>
Sat, 23 Oct 2010 18:27:35 +0000
(19:27 +0100)
committer
Ian Beckwith
<ianb@erislabs.net>
Sat, 23 Oct 2010 18:27:35 +0000
(19:27 +0100)
lib/ID3FS/Path.pm
patch
|
blob
|
history
diff --git
a/lib/ID3FS/Path.pm
b/lib/ID3FS/Path.pm
index
c800bdb
..
e54c7e2
100644
(file)
--- a/
lib/ID3FS/Path.pm
+++ b/
lib/ID3FS/Path.pm
@@
-370,12
+370,11
@@
sub parse
sub number_joins
{
my($self, @elements)=@_;
sub number_joins
{
my($self, @elements)=@_;
- my @joins=
qw(INNER
);
+ my @joins=
("INNER"
);
my $table=1;
my $nextjoin=undef;
my $lastop=undef;
return (@joins) unless(@elements);
my $table=1;
my $nextjoin=undef;
my $lastop=undef;
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)
@@
-391,31
+390,32
@@
sub number_joins
}
elsif($op eq "OR")
{
}
elsif($op eq "OR")
{
+ # NOT/foo/OR needs an extra join
$nextjoin="INNER" if($lastop && $lastop eq "NOT");
}
$lastop=$op;
}
else
{
$nextjoin="INNER" if($lastop && $lastop eq "NOT");
}
$lastop=$op;
}
else
{
- # 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)
{
if(@elements)
{
+ # if tag has a value, eat the tag, shifting to the value
$thing=shift(@elements) if($elements[0]->type() == $TYPE_TAG);
}
elsif($self->{db}->tag_has_values($thing->id()))
{
$thing=shift(@elements) if($elements[0]->type() == $TYPE_TAG);
}
elsif($self->{db}->tag_has_values($thing->id()))
{
+ # if the expression ends in a tag that has a value
+ # (ie we have the tag and want the value)
+ # use an INNER join even if we were in a NOT
$nextjoin="INNER" if($nextjoin);
}
$nextjoin="INNER" if($nextjoin);
}
- $table++ if($nextjoin && $nextjoin eq "INNER");
- $thing->table($table);
if($nextjoin)
{
if($nextjoin)
{
- $table++
if($nextjoin eq "LEFT")
;
+ $table++;
push(@joins, $nextjoin);
$nextjoin=undef;
}
push(@joins, $nextjoin);
$nextjoin=undef;
}
+ $thing->table($table);
}
}
return @joins;
}
}
return @joins;