Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/mysql-functions
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-09-03 14:18:01 +0200
committerErich Eckner <git@eckner.net>2018-09-03 14:18:01 +0200
commit385150b196c418d3056e02bf9a0f22a2f383bff7 (patch)
tree8be2ce8ccfe00ed2feb34b3c57847179ce0ac649 /lib/mysql-functions
parenta4938cc0a9594028d117b970ce973155444ff565 (diff)
lib/mysql-functions: mysql_load_min_and_max_versions() new
Diffstat (limited to 'lib/mysql-functions')
-rwxr-xr-xlib/mysql-functions29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/mysql-functions b/lib/mysql-functions
index 8cdafad..6c8154c 100755
--- a/lib/mysql-functions
+++ b/lib/mysql-functions
@@ -1257,3 +1257,32 @@ mysql_sort_versions() {
mysql_run_query
)
}
+
+# mysql_load_min_and_max_versions
+# load the minimal and maximal versions into min_version and max_version
+
+mysql_load_min_and_max_versions() {
+ if [ -z "${min_version}" ]; then
+ min_version=$(
+ {
+ printf 'SELECT CONCAT(`versions`.`epoch`,":",`versions`.`version`)'
+ printf ' FROM `versions`'
+ printf ' ORDER BY `versions`.`order`'
+ printf ' LIMIT 1'
+ } | \
+ mysql_run_query
+ )
+ fi
+
+ if [ -z "${max_version}" ]; then
+ max_version=$(
+ {
+ printf 'SELECT CONCAT(`versions`.`epoch`,":",`versions`.`version`)'
+ printf ' FROM `versions`'
+ printf ' ORDER BY `versions`.`order` DESC'
+ printf ' LIMIT 1'
+ } | \
+ mysql_run_query
+ )
+ fi
+}