summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-05-09 14:29:38 +0200
committerErich Eckner <git@eckner.net>2018-05-09 14:29:38 +0200
commit6c5285a3e9529e1afd04322e320d46a77a9d3cbf (patch)
tree527dfe7ded40cee8dce00e8305ac2717507e6868
parent2a7cc8a65a30c92ddd42d2ea33d324f41319fbe7 (diff)
downloadbuilder-6c5285a3e9529e1afd04322e320d46a77a9d3cbf.tar.xz
lib/mysql-functions: mysql_repair_binary_packages_in_repositories() new
-rwxr-xr-xlib/mysql-functions19
1 files changed, 19 insertions, 0 deletions
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