LQ5QEDVVHVGX67NJZQ46HOSY336VCLN63L3DT6QNSDV6ARVARITAC }sub attrsToSQL {my ($attrs, $id) = @_;my @attrs = split / /, $attrs;my $query = "1 = 1";foreach my $attr (@attrs) {$attr =~ /^([\w-]+)=([\w-]*)$/ or die "invalid attribute in release set: $attr";my $name = $1;my $value = $2;# !!! Yes, this is horribly injection-prone... (though# name/value are filtered above). Should use SQL::Abstract,# but it can't deal with subqueries. At least we should use# placeholders.$query .= " and (select count(*) from buildinputs where build = $id and name = '$name' and value = '$value') = 1";}return $query;
{ join => 'resultInfo', order_by => "timestamp DESC", '+select' => ["resultInfo.releasename"], '+as' => ["releasename"] });
{ join => 'resultInfo', order_by => "timestamp DESC", '+select' => ["resultInfo.releasename"], '+as' => ["releasename"], where => \ attrsToSQL($primaryJob->attrs, "me.id")});