Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-11-09 10:50:09 +0100
committerErich Eckner <git@eckner.net>2018-11-09 10:50:09 +0100
commitf89a3fd4c3577eba5a9e3f1c1d27c26fb8432f7b (patch)
treea7720fef45dd700374cda0843ed2d2354ac5bc28 /lib
parent1a9e9dc143b73b29113c5d22c0812f25c43cd34a (diff)
lib/mysql-joins.php new: it contains mysql_join_* functions similar to the ones in lib/mysql-functions of the build scripts
Diffstat (limited to 'lib')
-rw-r--r--lib/mysql-joins.php1438
-rw-r--r--lib/mysql.php1
2 files changed, 1439 insertions, 0 deletions
diff --git a/lib/mysql-joins.php b/lib/mysql-joins.php
new file mode 100644
index 0000000..751f1a0
--- /dev/null
+++ b/lib/mysql-joins.php
@@ -0,0 +1,1438 @@
+<?php
+
+/**
+ * generate below content with
+ * php mysql-joins.php
+ * executed from the builder directory
+ **/
+
+if (!isset($_SERVER["SERVER_ADDR"])) {
+ foreach (array('.', '../builder', '../../builder') as $base_dir)
+ if (file_exists($base_dir . '/lib/mysql-functions')) {
+ putenv('base_dir=' . $base_dir);
+ break;
+ }
+ $new_output =
+ "\n" .
+ trim(
+ shell_exec(
+ '. ${base_dir}/lib/mysql-functions;' .
+ 'declare -f $(' .
+ 'declare -F | cut -d" " -f3 | grep "^mysql_join_[a-z]" | grep -v "with_version"' .
+ ')'
+ )
+ );
+ $output = "";
+ $i = 5;
+ while ((strcmp($new_output,$output)!=0) && ($i > 0)) {
+ $output = $new_output;
+ $new_output =
+ preg_replace(
+ array(
+ '/ \[ -n "([^"]+)" \]; then/',
+ '/(\n\s*printf '."'[^'%]*)%s([^']*'".') "(\$[0-9]+)"/',
+ '/(\n\s*if [^\n]*)(\n([^\n]*;\n)+\s*)(else)(\n([^\n]*;\n)+\s*)fi;?\n/',
+ '/(\n\s*if [^\n]*)(\n([^\n]*;\n)+\s*)fi;?\n/'
+ ),
+ array(
+ ' (!empty(\1))',
+ '\1'."'".'.\3.'."'".'\2',
+ '\1 {\2} \4 {\5}'."\n",
+ '\1 {\2}'."\n"
+ ),
+ $output
+ );
+ $i--;
+ }
+ $output =
+ preg_replace(
+ array(
+ '/\$1/',
+ '/\$2/',
+ '/(\n)(\S+) \(\)\s*\n{/',
+ '/(\n})/',
+ '/(\s)printf(\s)/'
+ ),
+ array(
+ '$table_left',
+ '$table_right',
+ '\1function \2 ($table_left="", $table_right="") {'."\n".' $result = "";',
+ "\n".' return $result;\1',
+ '\1$result .=\2'
+ ),
+ $output
+ );
+ print $output . "\n";
+ die();
+}
+
+// auto-generated content below
+
+function mysql_join_allowed_email_actions_email_actions ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `email_actions`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`action`=';
+ } else {
+ $result .= ' ON `allowed_email_actions`.`action`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`email_actions`.`id`';
+ }
+ return $result;
+}
+function mysql_join_allowed_email_actions_gpg_keys ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `gpg_keys`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`gpg_key`=';
+ } else {
+ $result .= ' ON `allowed_email_actions`.`gpg_key`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`gpg_keys`.`id`';
+ }
+ return $result;
+}
+function mysql_join_architectures_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 `architectures`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`architecture`';
+ } else {
+ $result .= '`binary_packages`.`architecture`';
+ }
+ return $result;
+}
+function mysql_join_architectures_build_assignments ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `build_assignments`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `architectures`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`architecture`';
+ } else {
+ $result .= '`build_assignments`.`architecture`';
+ }
+ return $result;
+}
+function mysql_join_architectures_repositories ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `repositories`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `architectures`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`architecture`';
+ } else {
+ $result .= '`repositories`.`architecture`';
+ }
+ return $result;
+}
+function mysql_join_binary_packages_architectures ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `architectures`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`architecture`=';
+ } else {
+ $result .= ' ON `binary_packages`.`architecture`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`architectures`.`id`';
+ }
+ return $result;
+}
+function mysql_join_binary_packages_binary_packages_in_repositories ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `binary_packages_in_repositories`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `binary_packages`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`package`';
+ } else {
+ $result .= '`binary_packages_in_repositories`.`package`';
+ }
+ return $result;
+}
+function mysql_join_binary_packages_build_assignments ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `build_assignments`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`build_assignment`=';
+ } else {
+ $result .= ' ON `binary_packages`.`build_assignment`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`build_assignments`.`id`';
+ }
+ return $result;
+}
+function mysql_join_binary_packages_build_dependency_loops ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `build_dependency_loops`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`build_assignment`=';
+ } else {
+ $result .= ' ON `binary_packages`.`build_assignment`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`build_assignment`';
+ } else {
+ $result .= '`build_dependency_loops`.`build_assignment`';
+ }
+ return $result;
+}
+function mysql_join_binary_packages_build_slaves ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `build_slaves`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`build_assignment`=';
+ } else {
+ $result .= ' ON `binary_packages`.`build_assignment`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`currently_building`';
+ } else {
+ $result .= '`build_slaves`.`currently_building`';
+ }
+ return $result;
+}
+function mysql_join_binary_packages_dependencies ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `dependencies`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `binary_packages`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`dependent`';
+ } else {
+ $result .= '`dependencies`.`dependent`';
+ }
+ return $result;
+}
+function mysql_join_binary_packages_in_repositories_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.'`.`package`=';
+ } else {
+ $result .= ' ON `binary_packages_in_repositories`.`package`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`binary_packages`.`id`';
+ }
+ return $result;
+}
+function mysql_join_binary_packages_in_repositories_dependencies ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `dependencies`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`package`=';
+ } else {
+ $result .= ' ON `binary_packages_in_repositories`.`package`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`dependent`';
+ } else {
+ $result .= '`dependencies`.`dependent`';
+ }
+ return $result;
+}
+function mysql_join_binary_packages_in_repositories_install_target_providers ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `install_target_providers`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`package`=';
+ } else {
+ $result .= ' ON `binary_packages_in_repositories`.`package`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`package`';
+ } else {
+ $result .= '`install_target_providers`.`package`';
+ }
+ return $result;
+}
+function mysql_join_binary_packages_in_repositories_repositories ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `repositories`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`repository`=';
+ } else {
+ $result .= ' ON `binary_packages_in_repositories`.`repository`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`repositories`.`id`';
+ }
+ return $result;
+}
+function mysql_join_binary_packages_install_target_providers ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `install_target_providers`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `binary_packages`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`package`';
+ } else {
+ $result .= '`install_target_providers`.`package`';
+ }
+ return $result;
+}
+function mysql_join_build_assignments_architectures ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `architectures`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`architecture`=';
+ } else {
+ $result .= ' ON `build_assignments`.`architecture`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`architectures`.`id`';
+ }
+ return $result;
+}
+function mysql_join_build_assignments_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 `build_assignments`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`build_assignment`';
+ } else {
+ $result .= '`binary_packages`.`build_assignment`';
+ }
+ return $result;
+}
+function mysql_join_build_assignments_build_dependency_loops ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `build_dependency_loops`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `build_assignments`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`build_assignment`';
+ } else {
+ $result .= '`build_dependency_loops`.`build_assignment`';
+ }
+ return $result;
+}
+function mysql_join_build_assignments_build_slaves ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `build_slaves`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `build_assignments`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`currently_building`';
+ } else {
+ $result .= '`build_slaves`.`currently_building`';
+ }
+ return $result;
+}
+function mysql_join_build_assignments_failed_builds ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `failed_builds`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `build_assignments`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`build_assignment`';
+ } else {
+ $result .= '`failed_builds`.`build_assignment`';
+ }
+ return $result;
+}
+function mysql_join_build_assignments_package_sources ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `package_sources`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`package_source`=';
+ } else {
+ $result .= ' ON `build_assignments`.`package_source`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`package_sources`.`id`';
+ }
+ return $result;
+}
+function mysql_join_build_dependency_loops_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.'`.`build_assignment`=';
+ } else {
+ $result .= ' ON `build_dependency_loops`.`build_assignment`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`build_assignment`';
+ } else {
+ $result .= '`binary_packages`.`build_assignment`';
+ }
+ return $result;
+}
+function mysql_join_build_dependency_loops_build_assignments ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `build_assignments`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`build_assignment`=';
+ } else {
+ $result .= ' ON `build_dependency_loops`.`build_assignment`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`build_assignments`.`id`';
+ }
+ return $result;
+}
+function mysql_join_build_slaves_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.'`.`currently_building`=';
+ } else {
+ $result .= ' ON `build_slaves`.`currently_building`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`build_assignment`';
+ } else {
+ $result .= '`binary_packages`.`build_assignment`';
+ }
+ return $result;
+}
+function mysql_join_build_slaves_build_assignments ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `build_assignments`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`currently_building`=';
+ } else {
+ $result .= ' ON `build_slaves`.`currently_building`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`build_assignments`.`id`';
+ }
+ return $result;
+}
+function mysql_join_build_slaves_failed_builds ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `failed_builds`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `build_slaves`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`build_slave`';
+ } else {
+ $result .= '`failed_builds`.`build_slave`';
+ }
+ return $result;
+}
+function mysql_join_build_slaves_ssh_keys ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `ssh_keys`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`ssh_key`=';
+ } else {
+ $result .= ' ON `build_slaves`.`ssh_key`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`ssh_keys`.`id`';
+ }
+ return $result;
+}
+function mysql_join_build_slaves_ssh_log ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `ssh_log`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `build_slaves`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`build_slave`';
+ } else {
+ $result .= '`ssh_log`.`build_slave`';
+ }
+ return $result;
+}
+function mysql_join_dependencies_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.'`.`dependent`=';
+ } else {
+ $result .= ' ON `dependencies`.`dependent`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`binary_packages`.`id`';
+ }
+ return $result;
+}
+function mysql_join_dependencies_binary_packages_in_repositories ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `binary_packages_in_repositories`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`dependent`=';
+ } else {
+ $result .= ' ON `dependencies`.`dependent`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`package`';
+ } else {
+ $result .= '`binary_packages_in_repositories`.`package`';
+ }
+ return $result;
+}
+function mysql_join_dependencies_dependency_types ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `dependency_types`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`dependency_type`=';
+ } else {
+ $result .= ' ON `dependencies`.`dependency_type`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`dependency_types`.`id`';
+ }
+ return $result;
+}
+function mysql_join_dependencies_install_target_providers ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `install_target_providers`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`depending_on`=';
+ } else {
+ $result .= ' ON `dependencies`.`depending_on`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`install_target`';
+ } else {
+ $result .= '`install_target_providers`.`install_target`';
+ }
+ return $result;
+}
+function mysql_join_dependencies_install_targets ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `install_targets`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`depending_on`=';
+ } else {
+ $result .= ' ON `dependencies`.`depending_on`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`install_targets`.`id`';
+ }
+ return $result;
+}
+function mysql_join_dependencies_versions ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `versions`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`version`=';
+ } else {
+ $result .= ' ON `dependencies`.`version`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`versions`.`id`';
+ }
+ return $result;
+}
+function mysql_join_dependency_types_dependencies ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `dependencies`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `dependency_types`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`dependency_type`';
+ } else {
+ $result .= '`dependencies`.`dependency_type`';
+ }
+ return $result;
+}
+function mysql_join_email_actions_allowed_email_actions ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `allowed_email_actions`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `email_actions`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`action`';
+ } else {
+ $result .= '`allowed_email_actions`.`action`';
+ }
+ return $result;
+}
+function mysql_join_email_actions_email_log ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `email_log`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `email_actions`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`action`';
+ } else {
+ $result .= '`email_log`.`action`';
+ }
+ return $result;
+}
+function mysql_join_email_log_email_actions ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `email_actions`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`action`=';
+ } else {
+ $result .= ' ON `email_log`.`action`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`email_actions`.`id`';
+ }
+ return $result;
+}
+function mysql_join_email_log_gpg_keys ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `gpg_keys`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`gpg_key`=';
+ } else {
+ $result .= ' ON `email_log`.`gpg_key`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`gpg_keys`.`id`';
+ }
+ return $result;
+}
+function mysql_join_fail_reasons_failed_builds ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `failed_builds`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `fail_reasons`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`reason`';
+ } else {
+ $result .= '`failed_builds`.`reason`';
+ }
+ return $result;
+}
+function mysql_join_failed_builds_build_assignments ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `build_assignments`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`build_assignment`=';
+ } else {
+ $result .= ' ON `failed_builds`.`build_assignment`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`build_assignments`.`id`';
+ }
+ return $result;
+}
+function mysql_join_failed_builds_build_slaves ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `build_slaves`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`build_slave`=';
+ } else {
+ $result .= ' ON `failed_builds`.`build_slave`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`build_slaves`.`id`';
+ }
+ return $result;
+}
+function mysql_join_failed_builds_fail_reasons ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `fail_reasons`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`reason`=';
+ } else {
+ $result .= ' ON `failed_builds`.`reason`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`fail_reasons`.`id`';
+ }
+ return $result;
+}
+function mysql_join_git_repositories_upstream_repositories ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `upstream_repositories`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `git_repositories`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`git_repository`';
+ } else {
+ $result .= '`upstream_repositories`.`git_repository`';
+ }
+ return $result;
+}
+function mysql_join_gpg_keys_allowed_email_actions ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `allowed_email_actions`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `gpg_keys`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`gpg_key`';
+ } else {
+ $result .= '`allowed_email_actions`.`gpg_key`';
+ }
+ return $result;
+}
+function mysql_join_gpg_keys_email_log ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `email_log`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `gpg_keys`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`gpg_key`';
+ } else {
+ $result .= '`email_log`.`gpg_key`';
+ }
+ return $result;
+}
+function mysql_join_gpg_keys_persons ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `persons`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`owner`=';
+ } else {
+ $result .= ' ON `gpg_keys`.`owner`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`persons`.`id`';
+ }
+ return $result;
+}
+function mysql_join_install_target_providers_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.'`.`package`=';
+ } else {
+ $result .= ' ON `install_target_providers`.`package`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`binary_packages`.`id`';
+ }
+ return $result;
+}
+function mysql_join_install_target_providers_binary_packages_in_repositories ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `binary_packages_in_repositories`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`package`=';
+ } else {
+ $result .= ' ON `install_target_providers`.`package`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`package`';
+ } else {
+ $result .= '`binary_packages_in_repositories`.`package`';
+ }
+ return $result;
+}
+function mysql_join_install_target_providers_dependencies ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `dependencies`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`install_target`=';
+ } else {
+ $result .= ' ON `install_target_providers`.`install_target`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`depending_on`';
+ } else {
+ $result .= '`dependencies`.`depending_on`';
+ }
+ return $result;
+}
+function mysql_join_install_target_providers_install_targets ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `install_targets`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`install_target`=';
+ } else {
+ $result .= ' ON `install_target_providers`.`install_target`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`install_targets`.`id`';
+ }
+ return $result;
+}
+function mysql_join_install_target_providers_versions ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `versions`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`version`=';
+ } else {
+ $result .= ' ON `install_target_providers`.`version`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`versions`.`id`';
+ }
+ return $result;
+}
+function mysql_join_install_targets_dependencies ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `dependencies`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `install_targets`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`depending_on`';
+ } else {
+ $result .= '`dependencies`.`depending_on`';
+ }
+ return $result;
+}
+function mysql_join_install_targets_install_target_providers ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `install_target_providers`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `install_targets`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`install_target`';
+ } else {
+ $result .= '`install_target_providers`.`install_target`';
+ }
+ return $result;
+}
+function mysql_join_package_sources_build_assignments ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `build_assignments`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `package_sources`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`package_source`';
+ } else {
+ $result .= '`build_assignments`.`package_source`';
+ }
+ return $result;
+}
+function mysql_join_package_sources_repository_moves ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `repository_moves`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`upstream_package_repository`=';
+ } else {
+ $result .= ' ON `package_sources`.`upstream_package_repository`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`upstream_package_repository`';
+ } else {
+ $result .= '`repository_moves`.`upstream_package_repository`';
+ }
+ return $result;
+}
+function mysql_join_package_sources_toolchain_order ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `toolchain_order`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`pkgbase`=';
+ } else {
+ $result .= ' ON `package_sources`.`pkgbase`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`pkgbase`';
+ } else {
+ $result .= '`toolchain_order`.`pkgbase`';
+ }
+ return $result;
+}
+function mysql_join_package_sources_upstream_repositories ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `upstream_repositories`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`upstream_package_repository`=';
+ } else {
+ $result .= ' ON `package_sources`.`upstream_package_repository`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`upstream_repositories`.`id`';
+ }
+ return $result;
+}
+function mysql_join_persons_gpg_keys ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `gpg_keys`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `persons`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`owner`';
+ } else {
+ $result .= '`gpg_keys`.`owner`';
+ }
+ return $result;
+}
+function mysql_join_persons_ssh_keys ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `ssh_keys`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `persons`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`owner`';
+ } else {
+ $result .= '`ssh_keys`.`owner`';
+ }
+ return $result;
+}
+function mysql_join_repositories_architectures ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `architectures`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`architecture`=';
+ } else {
+ $result .= ' ON `repositories`.`architecture`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`architectures`.`id`';
+ }
+ return $result;
+}
+function mysql_join_repositories_binary_packages_in_repositories ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `binary_packages_in_repositories`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `repositories`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`repository`';
+ } else {
+ $result .= '`binary_packages_in_repositories`.`repository`';
+ }
+ return $result;
+}
+function mysql_join_repositories_repository_stabilities ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `repository_stabilities`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`stability`=';
+ } else {
+ $result .= ' ON `repositories`.`stability`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`repository_stabilities`.`id`';
+ }
+ return $result;
+}
+function mysql_join_repository_moves_package_sources ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `package_sources`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`upstream_package_repository`=';
+ } else {
+ $result .= ' ON `repository_moves`.`upstream_package_repository`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`upstream_package_repository`';
+ } else {
+ $result .= '`package_sources`.`upstream_package_repository`';
+ }
+ return $result;
+}
+function mysql_join_repository_moves_upstream_repositories ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `upstream_repositories`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`upstream_package_repository`=';
+ } else {
+ $result .= ' ON `repository_moves`.`upstream_package_repository`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`upstream_repositories`.`id`';
+ }
+ return $result;
+}
+function mysql_join_repository_stabilities_repositories ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `repositories`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `repository_stabilities`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`stability`';
+ } else {
+ $result .= '`repositories`.`stability`';
+ }
+ return $result;
+}
+function mysql_join_ssh_keys_build_slaves ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `build_slaves`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `ssh_keys`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`ssh_key`';
+ } else {
+ $result .= '`build_slaves`.`ssh_key`';
+ }
+ return $result;
+}
+function mysql_join_ssh_keys_persons ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `persons`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`owner`=';
+ } else {
+ $result .= ' ON `ssh_keys`.`owner`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`persons`.`id`';
+ }
+ return $result;
+}
+function mysql_join_ssh_log_build_slaves ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `build_slaves`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`build_slave`=';
+ } else {
+ $result .= ' ON `ssh_log`.`build_slave`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`build_slaves`.`id`';
+ }
+ return $result;
+}
+function mysql_join_toolchain_order_package_sources ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `package_sources`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`pkgbase`=';
+ } else {
+ $result .= ' ON `toolchain_order`.`pkgbase`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`pkgbase`';
+ } else {
+ $result .= '`package_sources`.`pkgbase`';
+ }
+ return $result;
+}
+function mysql_join_upstream_repositories_git_repositories ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `git_repositories`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`git_repository`=';
+ } else {
+ $result .= ' ON `upstream_repositories`.`git_repository`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`git_repositories`.`id`';
+ }
+ return $result;
+}
+function mysql_join_upstream_repositories_package_sources ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `package_sources`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `upstream_repositories`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`upstream_package_repository`';
+ } else {
+ $result .= '`package_sources`.`upstream_package_repository`';
+ }
+ return $result;
+}
+function mysql_join_upstream_repositories_repository_moves ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `repository_moves`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `upstream_repositories`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`upstream_package_repository`';
+ } else {
+ $result .= '`repository_moves`.`upstream_package_repository`';
+ }
+ return $result;
+}
+function mysql_join_versions_dependencies ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `dependencies`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `versions`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`version`';
+ } else {
+ $result .= '`dependencies`.`version`';
+ }
+ return $result;
+}
+function mysql_join_versions_install_target_providers ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `install_target_providers`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `versions`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`version`';
+ } else {
+ $result .= '`install_target_providers`.`version`';
+ }
+ return $result;
+}
diff --git a/lib/mysql.php b/lib/mysql.php
index 8255b33..ec0a1ba 100644
--- a/lib/mysql.php
+++ b/lib/mysql.php
@@ -6,6 +6,7 @@ if (isset($mysql))
require_once "../init.php";
include_once BASE . "/lib/http.php";
+include_once BASE . "/lib/mysql-joins.php";
$mysql = new mysqli("localhost", "webserver", "empty", "buildmaster");
if ( $mysql -> connect_error ) {