'; } else { $iconic_spacer = ''; } $titles['Browse'] = $iconic_spacer . '' . $strBrowseForeignValues . ''; if ($propicon == 'both') { $titles['Browse'] .= ' ' . $strBrowseForeignValues . ''; } } else { $titles['Browse'] = $strBrowseForeignValues; } /** * Not selection yet required -> displays the selection form */ if (!isset($param) || $param[0] == '') { // Gets some core libraries require('./tbl_properties_common.php'); //$err_url = 'tbl_select.php' . $err_url; $url_query .= '&goto=tbl_select.php&back=tbl_select.php'; /** * Gets tables informations */ require('./tbl_properties_table_info.php'); /** * Displays top menu links */ require('./tbl_properties_links.php'); if (!isset($goto)) { $goto = $cfg['DefaultTabTable']; } // Defines the url to return to in case of error in the next sql statement $err_url = $goto . '?' . PMA_generate_common_url($db, $table); // Gets the list and number of fields $result = PMA_DBI_query('SHOW' . (PMA_MYSQL_INT_VERSION >= 40100 ? ' FULL' : '') . ' FIELDS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE); $fields_cnt = PMA_DBI_num_rows($result); // rabue: we'd better ensure, that all arrays are empty. $fields_list = $fields_null = $fields_type = $fields_collation = array(); while ($row = PMA_DBI_fetch_assoc($result)) { $fields_list[] = $row['Field']; $type = $row['Type']; // reformat mysql query output - staybyte - 9. June 2001 if (strncasecmp($type, 'set', 3) == 0 || strncasecmp($type, 'enum', 4) == 0) { $type = str_replace(',', ', ', $type); } else { $type = str_replace(array('binary', 'zerofill', 'unsigned'), '', strtolower($type)); } if (empty($type)) { $type = ' '; } $fields_null[] = $row['Null']; $fields_type[] = $type; $fields_collation[] = PMA_MYSQL_INT_VERSION >= 40100 && !empty($row['Collation']) && $row['Collation'] != 'NULL' ? $row['Collation'] : ''; } // end while PMA_DBI_free_result($result); unset($result, $type); // // retrieve keys into foreign fields, if any $cfgRelation = PMA_getRelationsParam(); // check also foreigners even if relwork is FALSE (to get // foreign keys from innodb) //$foreigners = ($cfgRelation['relwork'] ? PMA_getForeigners($db, $table) : FALSE); $foreigners = PMA_getForeigners($db, $table); ?>
 
:
 


 
 
' . $strOr . ' ' . $strDoAQuery; ?>
= 40100 ? '' . "\n" : ''; ?> = 40100 ? '' . "\n" : ''; ?>
' . $strCollation . '
' . $fields_collation[$i] . ' $field = $fields_list[$i]; // do not use require_once here require('./libraries/get_foreign.lib.php'); echo "\n"; // we got a bug report: in some cases, even if $disp is true, // there are no rows, so we add a fetch_array if ($foreigners && isset($foreigners[$field]) && isset($disp_row) && is_array($disp_row)) { // f o r e i g n k e y s echo ' ' . "\n"; } else if (isset($foreign_link) && $foreign_link == true) { ?> ' . "\n"; for ($j = 0; $j < $cnt_enum_value; $j++) { echo ' '; } // end for echo ' ' . "\n"; } else { // o t h e r c a s e s echo ' ' . "\n"; } ?>
do the work */ else { // Builds the query $sql_query = 'SELECT ' . (isset($distinct) ? 'DISTINCT ' : ''); // if all fields were selected to display, we do a SELECT * // (more efficient and this helps prevent a problem in IE // if one of the rows is edited and we come back to the Select results) if (count($param) == $max_number_of_fields) { $sql_query .= '* '; } else { $sql_query .= PMA_backquote(urldecode($param[0])); $c = count($param); for ($i = 1; $i < $c; $i++) { $sql_query .= ',' . PMA_backquote(urldecode($param[$i])); } } // end if $sql_query .= ' FROM ' . PMA_backquote($table); // The where clause if (trim($where) != '') { $sql_query .= ' WHERE ' . $where; } else { $w = $charsets = array(); $cnt_func = count($func); reset($func); while (list($i, $func_type) = each($func)) { if (PMA_MYSQL_INT_VERSION >= 40100) { list($charsets[$i]) = explode('_', $collations[$i]); } if (@$GLOBALS['cfg']['UnaryOperators'][$func_type] == 1) { $fields[$i] = ''; $w[] = PMA_backquote(urldecode($names[$i])) . ' ' . $func_type; } elseif (strncasecmp($types[$i], 'enum', 4) == 0) { if (!empty($fields[$i])) { if (!is_array($fields[$i])) { $fields[$i] = explode(',', $fields[$i]); } $enum_selected_count = count($fields[$i]); if ($func_type == '=' && $enum_selected_count > 1) { $func_type = $func[$i] = 'IN'; $parens_open = '('; $parens_close = ')'; } elseif ($func_type == '!=' && $enum_selected_count > 1) { $func_type = $func[$i] = 'NOT IN'; $parens_open = '('; $parens_close = ')'; } else { $parens_open = ''; $parens_close = ''; } $enum_where = '\'' . PMA_sqlAddslashes($fields[$i][0]) . '\''; if (PMA_MYSQL_INT_VERSION >= 40100 && $charsets[$i] != $charset_connection) { $enum_where = 'CONVERT(_utf8 ' . $enum_where . ' USING ' . $charsets[$i] . ') COLLATE ' . $collations[$i]; } for ($e = 1; $e < $enum_selected_count; $e++) { $enum_where .= ', '; $tmp_literal = '\'' . PMA_sqlAddslashes($fields[$i][$e]) . '\''; if (PMA_MYSQL_INT_VERSION >= 40100 && $charsets[$i] != $charset_connection) { $tmp_literal = 'CONVERT(_utf8 ' . $tmp_literal . ' USING ' . $charsets[$i] . ') COLLATE ' . $collations[$i]; } $enum_where .= $tmp_literal; unset($tmp_literal); } $w[] = PMA_backquote(urldecode($names[$i])) . ' ' . $func_type . ' ' . $parens_open . $enum_where . $parens_close; } } elseif ($fields[$i] != '') { if (preg_match('@char|binary|blob|text|set|date|time|year@i', $types[$i])) { $quot = '\''; } else { $quot = ''; } // Make query independant from the selected connection charset. if (PMA_MYSQL_INT_VERSION >= 40101 && $charsets[$i] != $charset_connection && preg_match('@char|binary|blob|text|set@i', $types[$i])) { $prefix = 'CONVERT(_utf8 '; $suffix = ' USING ' . $charsets[$i] . ') COLLATE ' . $collations[$i]; } else { $prefix = $suffix = ''; } // LIKE %...% if ($func_type == 'LIKE %...%') { $func_type = 'LIKE'; $fields[$i] = '%' . $fields[$i] . '%'; } $w[] = PMA_backquote(urldecode($names[$i])) . ' ' . $func_type . ' ' . $prefix . $quot . PMA_sqlAddslashes($fields[$i]) . $quot . $suffix; } // end if } // end for if ($w) { $sql_query .= ' WHERE ' . implode(' AND ', $w); } } // end if if ($orderField != '--nil--') { $sql_query .= ' ORDER BY ' . PMA_backquote(urldecode($orderField)) . ' ' . $order; } // end if include('./sql.php'); } ?>