diff --git a/adminer/include/editing.inc.php b/adminer/include/editing.inc.php
index 30a76319..f1e4b383 100644
--- a/adminer/include/editing.inc.php
+++ b/adminer/include/editing.inc.php
@@ -1,4 +1,81 @@
num_rows) {
+ echo "
" . lang('No rows.') . "\n";
+ } else {
+ echo "
\n";
+ $links = array(); // colno => orgtable - create links from these columns
+ $indexes = array(); // orgtable => array(column => colno) - primary keys
+ $columns = array(); // orgtable => array(column => ) - not selected columns in primary key
+ $blobs = array(); // colno => bool - display bytes for blobs
+ $types = array(); // colno => type - display char in
+ odd(''); // reset odd for each result
+ for ($i=0; $row = $result->fetch_row(); $i++) {
+ if (!$i) {
+ echo "";
+ for ($j=0; $j < count($row); $j++) {
+ $field = $result->fetch_field();
+ if (strlen($field->orgtable)) {
+ if (!isset($indexes[$field->orgtable])) {
+ // find primary key in each table
+ $indexes[$field->orgtable] = array();
+ foreach (indexes($field->orgtable, $dbh2) as $index) {
+ if ($index["type"] == "PRIMARY") {
+ $indexes[$field->orgtable] = array_flip($index["columns"]);
+ break;
+ }
+ }
+ $columns[$field->orgtable] = $indexes[$field->orgtable];
+ }
+ if (isset($columns[$field->orgtable][$field->orgname])) {
+ unset($columns[$field->orgtable][$field->orgname]);
+ $indexes[$field->orgtable][$field->orgname] = $j;
+ $links[$j] = $field->orgtable;
+ }
+ }
+ if ($field->charsetnr == 63) {
+ $blobs[$j] = true;
+ }
+ $types[$j] = $field->type;
+ echo "" . h($field->name);
+ }
+ echo " |
\n";
+ }
+ echo "";
+ foreach ($row as $key => $val) {
+ if (!isset($val)) {
+ $val = "NULL";
+ } else {
+ if ($blobs[$key] && !is_utf8($val)) {
+ $val = "" . lang('%d byte(s)', strlen($val)) . ""; //! link to download
+ } elseif (!strlen(trim($val, " \t"))) {
+ $val = " "; // some content to print a border
+ } else {
+ $val = nl2br(h($val));
+ if ($types[$key] == 254) {
+ $val = "$val
";
+ }
+ }
+ if (isset($links[$key]) && !$columns[$links[$key]]) {
+ $link = "edit=" . urlencode($links[$key]);
+ foreach ($indexes[$links[$key]] as $col => $j) {
+ $link .= "&where" . urlencode("[" . bracket_escape($col) . "]") . "=" . urlencode($row[$j]);
+ }
+ $val = "$val";
+ }
+ }
+ echo "$val";
+ }
+ }
+ echo " |
\n";
+ }
+}
+
function referencable_primary($self) {
$return = array(); // table_name => field
foreach (table_status_referencable() as $table_name => $table) {
diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php
index 3eae0984..b66462bb 100644
--- a/adminer/include/functions.inc.php
+++ b/adminer/include/functions.inc.php
@@ -283,83 +283,6 @@ function odd($return = ' class="odd"') {
return ($i++ % 2 ? $return : '');
}
-/** Print select result
-* @param Min_Result
-* @param Min_DB connection to examine indexes
-* @return null
-*/
-function select($result, $dbh2 = null) {
- if (!$result->num_rows) {
- echo "" . lang('No rows.') . "\n";
- } else {
- echo "
\n";
- $links = array(); // colno => orgtable - create links from these columns
- $indexes = array(); // orgtable => array(column => colno) - primary keys
- $columns = array(); // orgtable => array(column => ) - not selected columns in primary key
- $blobs = array(); // colno => bool - display bytes for blobs
- $types = array(); // colno => type - display char in
- odd(''); // reset odd for each result
- for ($i=0; $row = $result->fetch_row(); $i++) {
- if (!$i) {
- echo "";
- for ($j=0; $j < count($row); $j++) {
- $field = $result->fetch_field();
- if (strlen($field->orgtable)) {
- if (!isset($indexes[$field->orgtable])) {
- // find primary key in each table
- $indexes[$field->orgtable] = array();
- foreach (indexes($field->orgtable, $dbh2) as $index) {
- if ($index["type"] == "PRIMARY") {
- $indexes[$field->orgtable] = array_flip($index["columns"]);
- break;
- }
- }
- $columns[$field->orgtable] = $indexes[$field->orgtable];
- }
- if (isset($columns[$field->orgtable][$field->orgname])) {
- unset($columns[$field->orgtable][$field->orgname]);
- $indexes[$field->orgtable][$field->orgname] = $j;
- $links[$j] = $field->orgtable;
- }
- }
- if ($field->charsetnr == 63) {
- $blobs[$j] = true;
- }
- $types[$j] = $field->type;
- echo "" . h($field->name);
- }
- echo " |
\n";
- }
- echo "";
- foreach ($row as $key => $val) {
- if (!isset($val)) {
- $val = "NULL";
- } else {
- if ($blobs[$key] && !is_utf8($val)) {
- $val = "" . lang('%d byte(s)', strlen($val)) . ""; //! link to download
- } elseif (!strlen(trim($val, " \t"))) {
- $val = " "; // some content to print a border
- } else {
- $val = nl2br(h($val));
- if ($types[$key] == 254) {
- $val = "$val
";
- }
- }
- if (isset($links[$key]) && !$columns[$links[$key]]) {
- $link = "edit=" . urlencode($links[$key]);
- foreach ($indexes[$links[$key]] as $col => $j) {
- $link .= "&where" . urlencode("[" . bracket_escape($col) . "]") . "=" . urlencode($row[$j]);
- }
- $val = "$val";
- }
- }
- echo "$val";
- }
- }
- echo " |
\n";
- }
-}
-
/** Check whether the string is in UTF-8
* @param string
* @return bool