From 6c5285a3e9529e1afd04322e320d46a77a9d3cbf Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 9 May 2018 14:29:38 +0200 Subject: lib/mysql-functions: mysql_repair_binary_packages_in_repositories() new --- lib/mysql-functions | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'lib') diff --git a/lib/mysql-functions b/lib/mysql-functions index a51ac8c..d192112 100755 --- a/lib/mysql-functions +++ b/lib/mysql-functions @@ -905,6 +905,25 @@ mysql_package_name_query() { printf ')' } +# TODO: delete mysql_repair_binary_packages_in_repositories when obsolete + +# mysql_repair_binary_packages_in_repositories +# temporary function to keep binary_packages_in_repositories up-to-date +mysql_repair_binary_packages_in_repositories() { + { + printf 'DELETE `binary_packages_in_repositories`' + printf ' FROM `binary_packages_in_repositories`' + printf ' LEFT JOIN `binary_packages`' + printf ' ON `binary_packages`.`id`=`binary_packages_in_repositories`.`package`' + printf ' WHERE `binary_packages`.`repository` != `binary_packages_in_repositories`.`repository`;\n' + printf 'COMMIT;\n' + printf 'INSERT IGNORE INTO `binary_packages_in_repositories` (`package`,`repository`)' + printf ' SELECT `binary_packages`.`id`,`binary_packages`.`repository`' + printf ' FROM `binary_packages`;\n' + } | \ + mysql_run_query +} + # mysql_join_*_* # print 'JOIN' part of mysql query to connect the respective tables # these functions take 2 optional arguments, acting as aliases for -- cgit v1.2.3-70-g09d2