From 61b1a165073ef79ef588c8606f8bc94785e4db6d Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 8 May 2018 09:56:03 +0200 Subject: lib/mysql-functions: mysql_package_name_query make table names customizable --- lib/mysql-functions | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'lib/mysql-functions') diff --git a/lib/mysql-functions b/lib/mysql-functions index ede5867..03c73b3 100755 --- a/lib/mysql-functions +++ b/lib/mysql-functions @@ -5,7 +5,7 @@ # TODO: return ids on INSERT/UPDATE queries and use those in subsequent # queries -# shellcheck disable=SC2016,SC2039 +# shellcheck disable=SC2016,SC2039,SC2119,SC2120 if [ -z "${base_dir}" ]; then # just to make shellcheck happy @@ -67,7 +67,6 @@ mysql_run_query() { >&2 printf 'I could not complete a mysql query!\n' if [ ! -s "${work_dir}/build-master-sanity" ] && \ [ -z "${file_name_extra}" ]; then - # shellcheck disable=SC2119 printf '\001ACTION failed to execute a mysql query - can you have a look at "%s"?.\001\n' \ "${query_stdin##*/}" \ | irc_say @@ -891,18 +890,19 @@ mysql_query_select_pkgbase_and_revision() { mysql_join_package_sources_upstream_repositories } -# mysql_package_name_query +# mysql_package_name_query [binary_packages] [architectures] # print a mysql query of the full name of a package file -# shellcheck disable=SC2120 mysql_package_name_query() { + local bp_name="${1:-binary_packages}" + local a_name="${2:-architectures}" printf 'CONCAT(' - printf '`binary_packages`.`pkgname`,"-",' - printf 'IF(`binary_packages`.`epoch`=0,"",CONCAT(`binary_packages`.`epoch`,":")),' - printf '`binary_packages`.`pkgver`,"-",' - printf '`binary_packages`.`pkgrel`,".",' - printf '`binary_packages`.`sub_pkgrel`,"-",' - printf '`architectures`.`name`,".pkg.tar.xz"' + printf '`%s`.`pkgname`,"-",' "${bp_name}" + printf 'IF(`%s`.`epoch`=0,"",CONCAT(`%s`.`epoch`,":")),' "${bp_name}" "${bp_name}" + printf '`%s`.`pkgver`,"-",' "${bp_name}" + printf '`%s`.`pkgrel`,".",' "${bp_name}" + printf '`%s`.`sub_pkgrel`,"-",' "${bp_name}" + printf '`%s`.`name`,".pkg.tar.xz"' "${a_name}" printf ')' } -- cgit v1.2.3-54-g00ecf