{
($self->{sqlconditions},
$self->{andsneeded}) = $self->{tagtree}->to_sql();
+# print "TREE: ", $self->{tagtree}->print(), "\n";
# print("SQL CONDITION(", $self->{andsneeded}, "): ",
# $self->{sqlconditions}, "\n");
# use Data::Dumper;
{
if(ref($thing) eq "ID3FS::PathElement::Tag")
{
+ # Handle tag values by dropping parent
+ if(@input && ref($input[$#input]) eq "ID3FS::PathElement::Tag")
+ {
+ $thing=shift @input;
+ }
push(@output, $thing);
}
elsif(ref($thing) eq "ID3FS::PathElement::Boolean")
{
push(@output, pop(@opstack));
}
-# print "STACK: ", join(', ', map { $_->{name}; } @output), "\n";
+# print "STACK: ", join(', ', map { $_->{name}; } @output), "\n";
return @output;
}
}
my $hasvals=$self->tag_has_values();
my $parent=$self->trailing_tag_parent();
- print "THASVALS: $hasvals\n";
- print "TPARENT: ", (defined($parent)? $parent : "NO"), "\n";
+# print "THASVALS: $hasvals\n";
+# print "TPARENT: ", (defined($parent)? $parent : "NO"), "\n";
my @ids=();
my $sql=("SELECT tags.name FROM (\n" .
$self->tags_subselect() .
my (@allused)=$self->used_tags();
my @used=grep { ref($_) ne "ARRAY"; } @allused;
my @used_with_vals=grep { ref($_) eq "ARRAY"; } @allused;
- print "tags(): USED: ", join(", ", @used), "\n";
- print "tags(): USED_WITH_VALS: ", join(", ", map { "[".$_->[0]. ", ".$_->[1]."]";} @used_with_vals), "\n";
+# print "tags(): USED: ", join(", ", @used), "\n";
+# print "tags(): USED_WITH_VALS: ", join(", ", map { "[".$_->[0]. ", ".$_->[1]."]";} @used_with_vals), "\n";
my @orclauses=();
my @andclauses=();
my $id=$self->trailing_tag_id();
if($hasvals)
{
- print "HAS_VALUES\n";
+# print "HAS_VALUES\n";
my @values=map { "'".$_->[1]."'"; } grep { $_->[0] == $id; } @used_with_vals;
my $clause="(tags.parents_id='$id'";
if(@values)
}
else
{
- print "HASNT VALUES\n";;
+# print "HASNT VALUES\n";;
if(@used)
{
push(@orclauses, "(NOT (tags.parents_id='' AND tags.id IN (" . join(', ', @used) . ")))");
if($hasvals)
{
$tag=$self->trailing_tag_id();
- print "Trailing id: $tag\n";
+# print "Trailing id: $tag\n";
}
my ($sqlclause, $joinsneeded)=(undef, 1);
($sqlclause, $joinsneeded) = $tree->to_sql($tag) if($tree);
($leftstr, $leftandlevel) = $self->node_to_sql($left, $parent, $andlevel);
# print "LEFT: $leftstr\n";
$andlevel=$self->max($andlevel, $leftandlevel);
+ if($op)
+ {
+ if(ref($op) eq "ID3FS::PathElement::Boolean")
+ {
+# print "Op: Bool: ", $op->{name}, "\n";
+ }
+ else
+ {
+# print "Op: $op\n";
+ }
+ }
if(defined($op) && (($op->{name} eq "AND") || ($op->{name} eq "NOT")))
{
$andlevel++;
{
$str="(" . $str . ")";
}
+# print "STR: $str\n";
return($str, $self->max($leftandlevel, $rightandlevel));
}
my($self, $node, $parent, $andlevel)=@_;
return ("", $andlevel) unless(defined($node));
return $node->to_sql($parent, $andlevel) if(ref($node) eq "ID3FS::Path::Node");
+# if((ref($node->op()) ne "ID3FS::Path::Element") &&
+# $node->op() eq "
my $sql;
# print("Hit node: " . $node->{name}. "(" .
# (defined($node->{parents_id}) ? $node->{parents_id} : "") .
# }
else
{
+# print "HIT NORMAL\n";
$sql= "(t$andlevel.parents_id=''";
$sql .= " AND fxt${andlevel}.tags_id='" . $node->{id} . "')";
}