From d235ae28781ae5c35b48b2ee462e6f1f9219d428 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Fri, 3 Jan 2020 14:17:30 +0100 Subject: lib/mysql-joins.php: new joins with `compressions` table --- lib/mysql-joins.php | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/lib/mysql-joins.php b/lib/mysql-joins.php index 751f1a0..561211d 100644 --- a/lib/mysql-joins.php +++ b/lib/mysql-joins.php @@ -248,6 +248,24 @@ function mysql_join_binary_packages_build_slaves ($table_left="", $table_right=" } return $result; } +function mysql_join_binary_packages_compressions ($table_left="", $table_right="") { + $result = ""; + $result .= ' JOIN `compressions`'; + if (!empty($table_right)) { + $result .= ' AS `'.$table_right.'`'; + } + if (!empty($table_left)) { + $result .= ' ON `'.$table_left.'`.`compression`='; + } else { + $result .= ' ON `binary_packages`.`compression`='; + } + if (!empty($table_right)) { + $result .= '`'.$table_right.'`.`id`'; + } else { + $result .= '`compressions`.`id`'; + } + return $result; +} function mysql_join_binary_packages_dependencies ($table_left="", $table_right="") { $result = ""; $result .= ' JOIN `dependencies`'; @@ -590,6 +608,24 @@ function mysql_join_build_slaves_ssh_log ($table_left="", $table_right="") { } return $result; } +function mysql_join_compressions_binary_packages ($table_left="", $table_right="") { + $result = ""; + $result .= ' JOIN `binary_packages`'; + if (!empty($table_right)) { + $result .= ' AS `'.$table_right.'`'; + } + if (!empty($table_left)) { + $result .= ' ON `'.$table_left.'`.`id`='; + } else { + $result .= ' ON `compressions`.`id`='; + } + if (!empty($table_right)) { + $result .= '`'.$table_right.'`.`compression`'; + } else { + $result .= '`binary_packages`.`compression`'; + } + return $result; +} function mysql_join_dependencies_binary_packages ($table_left="", $table_right="") { $result = ""; $result .= ' JOIN `binary_packages`'; -- cgit v1.2.3