]> xenbits.xensource.com Git - osstest.git/commitdiff
SQL: Change "... LIKE '...\_...' ..." to "... LIKE '...\\_...' ..."
authorIan Jackson <ian.jackson@eu.citrix.com>
Mon, 10 Aug 2020 15:19:16 +0000 (16:19 +0100)
committerIan Jackson <ian.jackson@eu.citrix.com>
Mon, 10 Aug 2020 15:23:07 +0000 (16:23 +0100)
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
cs-bisection-step
mg-force-push
mg-report-host-usage-collect
sg-report-flight
sg-report-host-history
sg-report-job-history
ts-logs-capture

index 1e94b2820afb4b94a1ebd5adc01fd12b53ec0afd..0808202b9f546febd2fc0afe86fda5c67cbe525f 100644 (file)
@@ -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
index 8544bac0b9f3009a048e99211ea8ab174bd6ba22..762966da0d6e6c5dd28be81ce0862ab174fafd40 100755 (executable)
@@ -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};
index 3a701a11c816740a7f5f2bd168ef9edad68526bc..9c3cc786e6716ea967a0ea3983b76f1f082e0670 100755 (executable)
@@ -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
index 1944c8d7ffcfcab2ee7501b68d220f6190c79d12..34d2494318484e598380fb46ac4cba62a4e793d4 100755 (executable)
@@ -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);
index 35ec11e7278d8f1ba5f19eb76999c4d3e4cce533..3e0019b07084c0a65952e07f79f9168b250866c1 100755 (executable)
@@ -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.
index dc694ebe69a08cdce20610afbb4b0eba47f264f9..380f8fac68ed57311239998974b37a75839a616a 100755 (executable)
@@ -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()) {
index 22a286275f0bcbcd1a9f3295c835beb7f4d2186f..6008ca722c205474bc593ef7b927a105ba23ec06 100755 (executable)
@@ -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.)
 
index 62c281b8f426a04cc615af7a9d28b217ef694cba..ec494fe15bb9d15481c4465deff273f712918cf8 100755 (executable)
@@ -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);