index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2018-09-01 20:05:30 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-09-01 20:05:30 +0200 |
commit | c2fb97d586e8a2f4383823a36361207285d94d4d (patch) | |
tree | ec6d3c4f5a88b8a441ae32e2c9c16efab3fb75d3 /lib | |
parent | 5e08f8967397fb981734eaaf0f179676b9e139a9 (diff) |
-rwxr-xr-x | lib/mysql-functions | 18 |
diff --git a/lib/mysql-functions b/lib/mysql-functions index 9fe0984..c0f7790 100755 --- a/lib/mysql-functions +++ b/lib/mysql-functions @@ -1179,14 +1179,28 @@ mysql_update_versions_ordering() { ) } -# mysql_sort_versions -# sort the table of versions +# mysql_sort_versions [-f] +# sort the table of versions, iff versions without order exist or -f was +# given + mysql_sort_versions() { ( # new shell is intentional tmp_file=$( mktemp "tmp.mysql_sort_versions.XXXXXXXXXX" --tmpdir ) trap 'rm "${tmp_file}"' EXIT + if [ "x$1" != 'x-f' ] && \ + { + printf 'SELECT' + printf ' COUNT(1)' + printf ' FROM `versions`' + printf ' WHERE `versions`.`order` IS NULL' + } | \ + mysql_run_query | \ + grep -qxF '0'; then + # nothing to do + return 0 + fi { printf 'SELECT ' printf '`versions`.`%s`,' \ |