diff options
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/mysql-functions | 29 |
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 +} |