| version 1.136, 2004/04/18 14:17:07 |
version 1.137, 2004/04/18 17:23:34 |
|
|
| * http://platon.sk/projects/phpMyEdit/ |
* http://platon.sk/projects/phpMyEdit/ |
| */ |
*/ |
| |
|
| /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.135 2004/04/17 11:35:48 nepto Exp $ */ |
/* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.136 2004/04/18 14:17:07 nepto Exp $ */ |
| |
|
| /* This is a generic table editing program. The table and fields to be |
/* This is a generic table editing program. The table and fields to be |
| edited are defined in the calling program. |
edited are defined in the calling program. |
|
|
| |
|
| function create_join_clause() /* {{{ */ |
function create_join_clause() /* {{{ */ |
| { |
{ |
| $tbs[] = $this->tb; |
|
| $main_table = 'PMEtable0'; |
$main_table = 'PMEtable0'; |
| $join_clause = $this->tb." AS $main_table"; |
$join_clause = $this->tb." AS $main_table"; |
| for ($k = 0, $numfds = sizeof($this->fds); $k < $numfds; $k++) { |
for ($k = 0, $numfds = sizeof($this->fds); $k < $numfds; $k++) { |
|
|
| $join_desc = @$this->fdd[$main_column]['values']['description']; |
$join_desc = @$this->fdd[$main_column]['values']['description']; |
| if ($join_desc != '' && $join_column != '') { |
if ($join_desc != '' && $join_column != '') { |
| $join_table = 'PMEjoin'.$k; |
$join_table = 'PMEjoin'.$k; |
| if (! in_array($join_table, $tbs)) { |
$ar = array( |
| $ar = array( |
'main_table' => $main_table, |
| 'main_table' => $main_table, |
'main_column' => $main_column, |
| 'main_column' => $main_column, |
'join_table' => $join_table, |
| 'join_table' => $join_table, |
'join_column' => $join_column, |
| 'join_column' => $join_column, |
'join_description' => $join_desc); |
| 'join_description' => $join_desc); |
$join_clause .= " LEFT OUTER JOIN $db.$table AS $join_table ON "; |
| $join_clause .= " LEFT OUTER JOIN $db.$table AS $join_table ON "; |
$join_clause .= isset($this->fdd[$main_column]['values']['join']) |
| $join_clause .= isset($this->fdd[$main_column]['values']['join']) |
? $this->substituteVars($this->fdd[$main_column]['values']['join'], $ar) |
| ? $this->substituteVars($this->fdd[$main_column]['values']['join'], $ar) |
: "$join_table.$join_column = $main_table.$main_column"; |
| : "$join_table.$join_column = $main_table.$main_column"; |
|
| $tbs[] = $join_table; |
|
| } |
|
| } |
} |
| } |
} |
| return $join_clause; |
return $join_clause; |