my ($self, @input)=@_;
my @opstack=();
my @output=();
-# print "INPUT: ", join(', ', map { $_->{name}; } @input), "\n";
while(my $thing = shift @input)
{
if($self->is($TYPE_TAG, $thing))
{
push(@output, pop(@opstack));
}
-# print "STACK: ", join(', ', map { $_->{name}; } @output), "\n";
return @output;
}
}
my $hasvals=$self->expecting_values();
my $parent=$self->trailing_tag_parent();
-# print "THASVALS: $hasvals\n";
-# print "TPARENT: ", (defined($parent)? $parent : "NO"), "\n";
my @ids=();
my $sql="SELECT tags.name FROM ";
if($self->in_or())
my($self)=@_;
my $hasvals=$self->expecting_values();
my $tree=$self->{tagtree};
- my $parent=$self->trailing_tag_parent();
-
- my $tag=undef;
- if($hasvals)
- {
- $tag=$self->trailing_tag_id();
-# print "Trailing id: $tag\n";
- }
- my ($sqlclause, @joins)=(undef, ());
- ($sqlclause, @joins) = $tree->to_sql($hasvals) if($tree);
-# use Data::Dumper;
-# print Dumper $tree if($tree);
-# print "SQL(" . scalar(@joins) ."): $sqlclause\n";
+ my ($sqlclause, @joins)=$tree->to_sql($hasvals) if($tree);
my $sql="\tSELECT fxt1.files_id FROM tags t1";
my @crosses=();
my @inners=();
-# $joinsneeded++ if($tag);
for(my $i=0; $i <= $#joins; $i++)
{
my $cnt=$i+1;
$sql .= ("\n\t" . join(" ", @crosses)) if(@crosses);
$sql .= ("\n" . join("\n", @inners)) if(@inners);
$sql .= "\n\tWHERE $sqlclause" if($sqlclause);
-# if($tag)
-# {
-# $sql .= " AND t${joinsneeded}.parents_id='$tag'";
-# }
$sql .= "\n\tGROUP BY fxt1.files_id\n";
return $sql;
}