projects
/
id3fs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
150ddf0
)
OR: show all unused tags
author
Ian Beckwith
<ianb@erislabs.net>
Tue, 19 Oct 2010 04:38:12 +0000
(
05:38
+0100)
committer
Ian Beckwith
<ianb@erislabs.net>
Tue, 19 Oct 2010 04:38:12 +0000
(
05:38
+0100)
lib/ID3FS/Path.pm
patch
|
blob
|
history
diff --git
a/lib/ID3FS/Path.pm
b/lib/ID3FS/Path.pm
index
e99a801
..
4cf5fc2
100644
(file)
--- a/
lib/ID3FS/Path.pm
+++ b/
lib/ID3FS/Path.pm
@@
-504,11
+504,19
@@
sub tags
# print "THASVALS: $hasvals\n";
# print "TPARENT: ", (defined($parent)? $parent : "NO"), "\n";
my @ids=();
# print "THASVALS: $hasvals\n";
# print "TPARENT: ", (defined($parent)? $parent : "NO"), "\n";
my @ids=();
- my $sql=("SELECT tags.name FROM (\n" .
- $self->tags_subselect() .
- ") AS subselect\n" .
- "INNER JOIN files_x_tags ON subselect.files_id=files_x_tags.files_id\n" .
- "INNER JOIN tags ON files_x_tags.tags_id=tags.id\n");
+ my $sql="SELECT tags.name FROM ";
+ if($self->in_or())
+ {
+ $sql .= "files_x_tags\n";
+ }
+ else
+ {
+ $sql .= ("(\n" .
+ $self->tags_subselect() .
+ ") AS subselect\n" .
+ "INNER JOIN files_x_tags ON subselect.files_id=files_x_tags.files_id\n");
+ }
+ $sql .= "INNER JOIN tags ON files_x_tags.tags_id=tags.id\n";
my @andclauses=();
my $id=$self->trailing_tag_id();
my @andclauses=();
my $id=$self->trailing_tag_id();
@@
-679,6
+687,8
@@
sub tags_subselect
my $hasvals=$self->expecting_values();
if($self->{in_all})
{
my $hasvals=$self->expecting_values();
if($self->{in_all})
{
+ # FIXME: is this used?
+ die "IN_ALL CALLED!!\n";
return "\tSELECT id FROM files AS files_id\n";
}
my $tree=$self->{tagtree};
return "\tSELECT id FROM files AS files_id\n";
}
my $tree=$self->{tagtree};
@@
-743,7
+753,7
@@
sub sql_start
return $sql;
}
return $sql;
}
-
+# FIXME: remove
sub constraints_tag_list
{
my($self, @constraints)=@_;
sub constraints_tag_list
{
my($self, @constraints)=@_;
@@
-814,4
+824,20
@@
sub empty
return 1;
}
return 1;
}
+# if path is .../OR/ or .../OR/NOT
+sub in_or
+{
+ my($self)=@_;
+ my $tail=$self->tail();
+ return 0 unless($tail);
+ return 0 unless($tail->type() eq "boolean");
+ return 1 if($tail->name() eq "OR");
+ return 0 unless($tail->name() eq "NOT");
+ my $parent=$self->tail_parent();
+ return 0 unless($parent);
+ return 0 unless($parent->type() eq "boolean");
+ return 1 if($parent->name() eq "OR");
+ return 0;
+}
+
1;
1;