@@ -182,6 +182,14 @@ END
sub flight_rmap ($$) {
my ($flight, $need_urls) = @_;
+ my $qtxt_common_rev_ok = sub {
+ my ($table) = @_;
+ [<<END];
+ ($table.name LIKE E'built\\_revision\\_%' OR
+ $table.name LIKE E'revision\\_%')
+END
+ };
+
$dbh_tests->do(<<END, {});
CREATE TEMP TABLE tmp_build_info (
use varchar NOT NULL,
@@ -236,10 +244,6 @@ END
my $qtxt_common_tables = <<END;
FROM tmp_build_info AS rev
END
- my $qtxt_common_rev_condition = <<END;
- (rev.name LIKE E'built\\_revision\\_%' OR
- rev.name LIKE E'revision\\_%')
-END
my $sth= db_prepare(!$need_urls ? <<END_NOURLS : <<END_URLS);
SELECT
@@ -249,7 +253,7 @@ $qtxt_common_results
$qtxt_common_tables
WHERE
-$qtxt_common_rev_condition
+@{ $qtxt_common_rev_ok->('rev') }
ORDER by rev.name;
@@ -262,7 +266,7 @@ $qtxt_common_tables
CROSS JOIN tmp_build_info AS url
WHERE
-$qtxt_common_rev_condition
+@{ $qtxt_common_rev_ok->('rev') }
AND url.name LIKE E'tree\\_%'
AND url.use = rev.use
AND url.job = rev.job
* Make it into a subref which takes a $table argument. * Change the two references into function calls using the @{...} syntax * Move the definition earlier in the file No change to the generated query. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> --- v2: New patch. --- cs-bisection-step | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)