]> xenbits.xensource.com Git - people/aperard/osstest.git/commitdiff
SQL: Use "LIKE" rather than "like", etc.
authorIan Jackson <ian.jackson@eu.citrix.com>
Mon, 27 Jul 2020 11:43:27 +0000 (12:43 +0100)
committerIan Jackson <ian.jackson@eu.citrix.com>
Fri, 31 Jul 2020 16:09:41 +0000 (17:09 +0100)
This is more like the rest of the style.  It will also make it easier
to find instances of the mistaken LIKE syntax.

I found these with "git grep" and manually edited them.  I have
checked the before-and-after result of
   find * -type f | xargs perl -i~ -pe 's/\bLIKE\b/like/g'
and it has only the few expected changes to ANDs and ORs.

No functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
New in v2.

cr-ensure-disk-space
cs-adjust-flight
mg-force-push
mg-report-host-usage-collect
ms-planner
sg-report-flight
sg-report-host-history

index 3e0288f95d02d9a0ba356d604764b248952a684a..11d801b0737ac0b5985213832aa05f405984b95c 100755 (executable)
@@ -99,8 +99,8 @@ my $chkq= db_prepare("SELECT * FROM flights WHERE flight=?");
 my $refq= db_prepare(<<END);
     SELECT flight, val
       FROM runvars
-     WHERE name like '%job'
-       AND val like '%.%'
+     WHERE name LIKE '%job'
+       AND val LIKE '%.%'
        AND flight >= ?
 END
 
index 98d40891e5195b04688126f35915bb3c0825d94a..d04a2fd71848f6f99551faed564c3ff3b09a7b54 100755 (executable)
@@ -526,7 +526,7 @@ sub change__repro_buildjobs {
        }
     }
     my $testq = db_prepare(<<END);
-SELECT name, val FROM runvars WHERE flight=? AND job=? AND name like '%job';
+SELECT name, val FROM runvars WHERE flight=? AND job=? AND name LIKE '%job';
 END
     my $buildq_txt = <<END;
 SELECT name FROM runvars WHERE flight=? AND job=? AND ('f'
index 1066a300c73dcee0ee237d61da0e84791ba57193..001e0c4773d21cb60a8256aa24121ec85d0024a3 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 160d295fc0624708d9f6405ae1da28f5b0f1f3eb..3fab490a83e1c6a61ddca1add4480bca280783fb 100755 (executable)
@@ -154,10 +154,10 @@ END
         SELECT finished    prep_finished,
                status      prep_status
           FROM steps prep
-         WHERE flight=? and job=?
+         WHERE flight=? AND job=?
            AND prep.finished IS NOT NULL
            AND (prep.step='ts-host-build-prep'
-            OR  prep.step like 'ts-host-install%')
+            OR  prep.step LIKE 'ts-host-install%')
       ORDER BY stepno DESC
          LIMIT 1
 END
@@ -165,14 +165,14 @@ END
     my $hostsq = db_prepare(<<END);
         SELECT val, synth
           FROM runvars
-         WHERE flight=? and job=?
-           AND (name like '%_host' or name='host')
+         WHERE flight=? AND job=?
+           AND (name LIKE '%_host' OR name='host')
 END
 
     my $finishq = db_prepare(<<END);
         SELECT max(finished) AS finished
           FROM steps
-         WHERE flight=? and job=?
+         WHERE flight=? AND job=?
 END
 
     progress1 "minflight $minflight executing...";
index c70b46b0fac75ce1459256837c26c1e2015217fe..11423404c2fa7fc7ad899c9711ad9529d0dc8133 100755 (executable)
@@ -72,7 +72,7 @@ sub allocations ($$) {
                        ON owntaskid = taskid
                    WHERE NOT (tasks.type='magic' AND
                                tasks.refkey='allocatable')
-                      AND NOT (resources.restype like 'share-%'
+                      AND NOT (resources.restype LIKE 'share-%'
                            AND NOT EXISTS (
  SELECT 1 FROM resource_sharing sh
          WHERE sh.restype = substring(resources.restype from 7)
index 6c481f6f7fee08963d86690fe9a242a12354b5b6..0edb6e1a15085f5becc839e1f09cf5d0d44fb820 100755 (executable)
@@ -513,7 +513,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 54738e68214f0d9ef7218d25085fb92fccb769b5..c22a1704bef9f0e377a96f7baa41b995becb4887 100755 (executable)
@@ -37,7 +37,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/^-/) {
@@ -456,7 +456,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()) {