From f89a3fd4c3577eba5a9e3f1c1d27c26fb8432f7b Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Fri, 9 Nov 2018 10:50:09 +0100 Subject: lib/mysql-joins.php new: it contains mysql_join_* functions similar to the ones in lib/mysql-functions of the build scripts --- buildmaster/mysql-issues.php | 56 ++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'buildmaster/mysql-issues.php') diff --git a/buildmaster/mysql-issues.php b/buildmaster/mysql-issues.php index b149cad..19ef55d 100644 --- a/buildmaster/mysql-issues.php +++ b/buildmaster/mysql-issues.php @@ -25,19 +25,19 @@ require_once BASE . "/lib/mysql.php"; "`subst_r`.`name` AS `subst_repository`," . "`subst_buildlist_bp`.`id` AS `subst_buildlist`" . " FROM `binary_packages`" . - " JOIN `binary_packages_in_repositories` ON `binary_packages`.`id`=`binary_packages_in_repositories`.`package`" . - " JOIN `repositories` ON `binary_packages_in_repositories`.`repository`=`repositories`.`id`" . + mysql_join_binary_packages_binary_packages_in_repositories() . + mysql_join_binary_packages_in_repositories_repositories() . " AND `repositories`.`is_on_master_mirror`" . - " JOIN `architectures` AS `r_a` ON `repositories`.`architecture`=`r_a`.`id`" . - " JOIN `dependencies` ON `dependencies`.`dependent`=`binary_packages`.`id`" . - " JOIN `dependency_types` ON `dependencies`.`dependency_type`=`dependency_types`.`id`" . + mysql_join_repositories_architectures('','r_a') . + mysql_join_binary_packages_dependencies() . + mysql_join_dependencies_dependency_types() . " AND `dependency_types`.`relevant_for_binary_packages`" . - " JOIN `install_targets` ON `dependencies`.`depending_on`=`install_targets`.`id`" . - " JOIN `architectures` ON `binary_packages`.`architecture`=`architectures`.`id`" . + mysql_join_dependencies_install_targets() . + mysql_join_binary_packages_architectures() . " LEFT JOIN (" . "`binary_packages` AS `subst_bp`" . - " JOIN `binary_packages_in_repositories` as `subst_bpir` ON `subst_bp`.`id`=`subst_bpir`.`package`" . - " JOIN `repositories` AS `subst_r` ON `subst_bpir`.`repository`=`subst_r`.`id`" . + mysql_join_binary_packages_binary_packages_in_repositories('subst_bp','subst_bpir') . + mysql_join_binary_packages_in_repositories_repositories('subst_bpir','subst_r') . " JOIN `repository_stability_relations` ON `repository_stability_relations`.`less_stable`=`subst_r`.`stability`" . ")" . " ON `subst_bp`.`pkgname`=`binary_packages`.`pkgname`" . @@ -46,15 +46,15 @@ require_once BASE . "/lib/mysql.php"; " AND `subst_r`.`architecture`=`repositories`.`architecture`" . " LEFT JOIN (" . "`binary_packages` AS `subst_buildlist_bp`" . - " JOIN `binary_packages_in_repositories` AS `subst_buildlist_bpir` ON `subst_buildlist_bp`.`id`=`subst_buildlist_bpir`.`package`" . - " JOIN `repositories` AS `subst_buildlist_r` ON `subst_buildlist_bpir`.`repository`=`subst_buildlist_r`.`id`" . + mysql_join_binary_packages_binary_packages_in_repositories('subst_buildlist_bp','subst_buildlist_bpir') . + mysql_join_binary_packages_in_repositories_repositories('subst_buildlist_bpir','subst_buildlist_r') . " AND `subst_buildlist_r`.`name`=\"build-list\"". ") ON `subst_buildlist_bp`.`pkgname`=`binary_packages`.`pkgname`" . " AND `subst_bp`.`architecture`=`binary_packages`.`architecture`" . " WHERE NOT EXISTS (" . "SELECT 1 FROM `install_target_providers`" . - " JOIN `binary_packages_in_repositories` AS `i_bpir` ON `i_bpir`.`package`=`install_target_providers`.`package`" . - " JOIN `repositories` AS `i_r` ON `i_bpir`.`repository`=`i_r`.`id`" . + mysql_join_install_target_providers_binary_packages_in_repositories('','i_bpir') . + mysql_join_binary_packages_in_repositories_repositories('i_bpir','i_r') . " JOIN `architecture_compatibilities` ON `architecture_compatibilities`.`fully_compatible`" . " AND `architecture_compatibilities`.`built_for`=`i_r`.`architecture`" . " WHERE `install_target_providers`.`install_target`=`dependencies`.`depending_on`" . @@ -86,20 +86,20 @@ require_once BASE . "/lib/mysql.php"; "`repository_stabilities`.`name` AS `stability`," . "IF(`binary_packages_in_repositories`.`is_to_be_deleted`,1,0) AS `is_to_be_deleted`" . " FROM `binary_packages`" . - " JOIN `binary_packages_in_repositories` ON `binary_packages`.`id`=`binary_packages_in_repositories`.`package`" . - " JOIN `repositories` ON `binary_packages_in_repositories`.`repository`=`repositories`.`id`" . + mysql_join_binary_packages_binary_packages_in_repositories() . + mysql_join_binary_packages_in_repositories_repositories() . " AND `repositories`.`is_on_master_mirror`" . - " JOIN `architectures` AS `r_a` ON `repositories`.`architecture`=`r_a`.`id`" . - " JOIN `repository_stabilities` ON `repositories`.`stability`=`repository_stabilities`.`id`" . - " JOIN `dependencies` ON `dependencies`.`dependent`=`binary_packages`.`id`" . - " JOIN `dependency_types` ON `dependencies`.`dependency_type`=`dependency_types`.`id`" . + mysql_join_repositories_architectures('','r_a') . + mysql_join_repositories_repository_stabilities() . + mysql_join_binary_packages_dependencies() . + mysql_join_dependencies_dependency_types() . " AND `dependency_types`.`relevant_for_binary_packages`" . - " JOIN `install_targets` ON `dependencies`.`depending_on`=`install_targets`.`id`" . - " JOIN `architectures` ON `binary_packages`.`architecture`=`architectures`.`id`" . + mysql_join_dependencies_install_targets() . + mysql_join_binary_packages_architectures() . " WHERE EXISTS (" . "SELECT 1 FROM `install_target_providers`" . - " JOIN `binary_packages_in_repositories` AS `prov_bpir` ON `prov_bpir`.`package`=`install_target_providers`.`package`" . - " JOIN `repositories` AS `prov_r` ON `prov_r`.`id`=`prov_bpir`.`repository`" . + mysql_join_install_target_providers_binary_packages_in_repositories('','prov_bpir') . + mysql_join_binary_packages_in_repositories_repositories('prov_bpir','prov_r') . " JOIN `architecture_compatibilities` ON `architecture_compatibilities`.`built_for`=`prov_r`.`architecture`" . " AND `architecture_compatibilities`.`fully_compatible`" . " WHERE `install_target_providers`.`install_target` = `dependencies`.`depending_on`" . @@ -107,17 +107,17 @@ require_once BASE . "/lib/mysql.php"; ")" . " AND NOT EXISTS (" . "SELECT 1 FROM `install_target_providers`" . - " JOIN `binary_packages` AS `prov_bp` ON `prov_bp`.`id`=`install_target_providers`.`package`" . - " JOIN `binary_packages_in_repositories` AS `prov_bpir` ON `prov_bp`.`id`=`prov_bpir`.`package`" . - " JOIN `repositories` AS `prov_r` ON `prov_bpir`.`repository`=`prov_r`.`id`" . + mysql_join_install_target_providers_binary_packages('','prov_bp') . + mysql_join_binary_packages_binary_packages_in_repositories('prov_bp','prov_bpir') . + mysql_join_binary_packages_in_repositories_repositories('prov_bpir','prov_r') . " JOIN `repository_stability_relations` ON `prov_r`.`stability`=`repository_stability_relations`.`more_stable`" . " WHERE `install_target_providers`.`install_target` = `dependencies`.`depending_on`" . " AND `repositories`.`stability`=`repository_stability_relations`.`less_stable`" . " AND `repositories`.`architecture`=`prov_r`.`architecture`" . " AND NOT EXISTS (" . "SELECT 1 FROM `binary_packages` AS `sup_bp`" . - " JOIN `binary_packages_in_repositories` AS `sup_bpir` ON `sup_bp`.`id`=`sup_bpir`.`package`" . - " JOIN `repositories` AS `sup_r` ON `sup_bpir`.`repository`=`sup_r`.`id`" . + mysql_join_binary_packages_binary_packages_in_repositories('sup_bp','sup_bpir') . + mysql_join_binary_packages_in_repositories_repositories('sup_bpir','sup_r') . " JOIN `repository_stability_relations` AS `sup_rra` ON `sup_r`.`stability`=`sup_rra`.`more_stable`" . " JOIN `repository_stability_relations` AS `sup_rrb` ON `sup_r`.`stability`=`sup_rrb`.`less_stable`" . " WHERE `sup_bp`.`pkgname` = `prov_bp`.`pkgname`" . -- cgit v1.2.3-70-g09d2