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:
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
+}