diff mbox series

[OSSTEST] SQL: Change "... LIKE '...\_...' ..." to "... LIKE '...\\_...' ..."

Message ID 20200810152404.15325-1-ian.jackson@eu.citrix.com (mailing list archive)
State New, archived
Headers show
Series [OSSTEST] SQL: Change "... LIKE '...\_...' ..." to "... LIKE '...\\_...' ..." | expand

Commit Message

Ian Jackson Aug. 10, 2020, 3:24 p.m. UTC
Perl's "" quotes, and corresponding <<END constructs, do
\-interpolation, so remove these \ which we carefully added in
   e7a408dd01184df0a57ae5d9072d15225c52a99f
   SQL: Change LIKE E'...\\_...' to LIKE '...\_...'

This is only not a performance problem due to query mismathes with the
available indices, because the test indices are still present in the
Massachusetts instance.

I have verified that this has the intended chanve everywhere by
 1. Double-checking that eacbh of these instances is within <<END
    or "" or equivalent.
 2. Running git-ls-files | xargs perl -i -pe 's/\\\\_/\\_/g'
    and manually examining the diff against this patch's parent.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 Osstest/Executive.pm         | 2 +-
 cs-bisection-step            | 8 ++++----
 mg-force-push                | 2 +-
 mg-report-host-usage-collect | 2 +-
 sg-report-flight             | 4 ++--
 sg-report-host-history       | 8 ++++----
 sg-report-job-history        | 2 +-
 ts-logs-capture              | 2 +-
 8 files changed, 15 insertions(+), 15 deletions(-)
diff mbox series

Patch

diff --git a/Osstest/Executive.pm b/Osstest/Executive.pm
index 1e94b282..0808202b 100644
--- a/Osstest/Executive.pm
+++ b/Osstest/Executive.pm
@@ -444,7 +444,7 @@  END
 	    $querytext .= <<END;
 		    JOIN runvars r USING (flight)
 		   WHERE name=?
-                     AND name LIKE 'revision\_%'
+                     AND name LIKE 'revision\\_%'
 		     AND val=?
                      AND ${\ main_revision_job_cond('r.job') }
 END
diff --git a/cs-bisection-step b/cs-bisection-step
index 8544bac0..762966da 100755
--- a/cs-bisection-step
+++ b/cs-bisection-step
@@ -185,15 +185,15 @@  sub flight_rmap ($$) {
     my $qtxt_common_rev_ok = sub {
 	my ($table) = @_;
 	[<<END];
-                 ($table.name LIKE 'built\_revision\_%' OR
-                  $table.name LIKE 'revision\_%')
+                 ($table.name LIKE 'built\\_revision\\_%' OR
+                  $table.name LIKE 'revision\\_%')
 END
     };
 
     my $qtxt_common_tree_ok = sub {
 	my ($table) = @_;
 	[<<END];
-  	      $table.name LIKE 'tree\_%'
+  	      $table.name LIKE 'tree\\_%'
 END
     };
 
@@ -1226,7 +1226,7 @@  sub preparejob ($$$$) {
             INTO TEMP  bisection_runvars
                  FROM  runvars
                 WHERE  flight=? AND job=? AND synth='f'
-                  AND  name NOT LIKE 'revision\_%'
+                  AND  name NOT LIKE 'revision\\_%'
                   AND  name NOT LIKE '%host'
 END
     my (@trevisions) = split / /, $choose->{Rtuple};
diff --git a/mg-force-push b/mg-force-push
index 3a701a11..9c3cc786 100755
--- a/mg-force-push
+++ b/mg-force-push
@@ -54,7 +54,7 @@  END
         FROM rv url
         JOIN rv built
              ON url.job    = built.job
-            AND url.name   LIKE 'tree\_%'
+            AND url.name   LIKE 'tree\\_%'
             AND built.name = 'built_revision_' || substring(url.name, 6)
        WHERE url.val = ?
 END
diff --git a/mg-report-host-usage-collect b/mg-report-host-usage-collect
index 1944c8d7..34d24943 100755
--- a/mg-report-host-usage-collect
+++ b/mg-report-host-usage-collect
@@ -166,7 +166,7 @@  END
         SELECT val, synth
           FROM runvars
          WHERE flight=? AND job=?
-           AND (name LIKE '%\_host' OR name='host')
+           AND (name LIKE '%\\_host' OR name='host')
 END
 
     my $finishq = db_prepare(<<END);
diff --git a/sg-report-flight b/sg-report-flight
index 35ec11e7..3e0019b0 100755
--- a/sg-report-flight
+++ b/sg-report-flight
@@ -253,7 +253,7 @@  END
              JOIN runvars r$ri USING (flight)
 END
 	  $runvars_conds .= <<END;
-              AND r$ri.name LIKE 'built\_revision\_%' 
+              AND r$ri.name LIKE 'built\\_revision\\_%' 
               AND r$ri.name = ?
               AND r$ri.val= ?
 END
@@ -639,7 +639,7 @@  END
         my $revh= db_prepare(<<END);
             SELECT * FROM runvars
                 WHERE flight=$flight AND job='$j->{job}'
-                  AND name LIKE 'built\_revision\_%'
+                  AND name LIKE 'built\\_revision\\_%'
                 ORDER BY name
 END
         # We report in jobtext revisions in non-main-revision jobs, too.
diff --git a/sg-report-host-history b/sg-report-host-history
index dc694ebe..380f8fac 100755
--- a/sg-report-host-history
+++ b/sg-report-host-history
@@ -39,7 +39,7 @@  our @blessings;
 
 open DEBUG, ">/dev/null";
 
-my $namecond= "(name = 'host' OR name LIKE '%\_host')";
+my $namecond= "(name = 'host' OR name LIKE '%\\_host')";
 csreadconfig();
 
 while (@ARGV && $ARGV[0] =~ m/^-/) {
@@ -172,7 +172,7 @@  sub mainquery ($) {
 	SELECT flight, job, name, status
 	  FROM runvars
           JOIN jobs USING (flight, job)
-	 WHERE (name = 'host' OR name LIKE '%\_host')
+	 WHERE (name = 'host' OR name LIKE '%\\_host')
 	   AND val = ?
 	   AND $flightcond
            AND $restrictflight_cond
@@ -246,7 +246,7 @@  END
 	  FROM runvars
 	 WHERE flight=? AND job=?
            AND (
-               name LIKE (? || '\_power\_%')
+               name LIKE (? || '\\_power\\_%')
            )
 END
 
@@ -449,7 +449,7 @@  foreach my $host (@ARGV) {
 	        SELECT DISTINCT val
 		  FROM runvars
 		 WHERE flight=?
-		   AND (name = 'host' OR name LIKE '%\_host')
+		   AND (name = 'host' OR name LIKE '%\\_host')
 END
             $hostsinflightq->execute($flight);
 	    while (my $row = $hostsinflightq->fetchrow_hashref()) {
diff --git a/sg-report-job-history b/sg-report-job-history
index 22a28627..6008ca72 100755
--- a/sg-report-job-history
+++ b/sg-report-job-history
@@ -92,7 +92,7 @@  if (defined($flight)) {
 our $revisionsq= db_prepare(<<END);
         SELECT * FROM runvars
          WHERE flight=? AND job=?
-           AND name LIKE 'built\_revision\_%'
+           AND name LIKE 'built\\_revision\\_%'
 END
 # (We report on non-main-revision jobs just as for main-revision ones.)
 
diff --git a/ts-logs-capture b/ts-logs-capture
index 62c281b8..ec494fe1 100755
--- a/ts-logs-capture
+++ b/ts-logs-capture
@@ -44,7 +44,7 @@  our (@allguests, @guests);
 sub find_guests () {
     my $sth= $dbh_tests->prepare(<<END);
         SELECT name FROM runvars WHERE flight=? AND job=?
-            AND name LIKE '%\_domname'
+            AND name LIKE '%\\_domname'
             ORDER BY name
 END
     $sth->execute($flight, $job);