From c84507f8d9891e8b2d38f2753bcfe45afb5c72e5 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Thu, 10 Mar 2005 19:49:09 +0000 Subject: [PATCH] problem with getting comments when creating a new table under MySQL 4.1.x with extension mysql --- ChangeLog | 5 +++++ libraries/database_interface.lib.php | 4 ++++ libraries/relation.lib.php | 10 ++++++---- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6873f0443..01b239c79 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,11 @@ phpMyAdmin - Changelog $Id$ $Source$ +2005-03-10 Marc Delisle + * libraries/database_interface.lib.php, libraries/relation.lib.php: + problem with getting comments when creating a new table under MySQL 4.1.x + with mysql extension + 2005-03-09 Marc Delisle * db_operations.php: db comments updating broken * libraries/relation.lib.php: bug #1159415, data dictionary broken diff --git a/libraries/database_interface.lib.php b/libraries/database_interface.lib.php index 4d071c946..eb4169251 100644 --- a/libraries/database_interface.lib.php +++ b/libraries/database_interface.lib.php @@ -81,6 +81,10 @@ function PMA_DBI_get_fields($database, $table, $link = NULL) { // tbl_create + tbl_properties.inc.php, the table does not exist $result = PMA_DBI_try_query('SHOW FULL FIELDS FROM ' . PMA_backquote($database) . '.' . PMA_backquote($table), $link); + if (!$result) { + return FALSE; + } + $fields = array(); while ($row = PMA_DBI_fetch_assoc($result)) { $fields[] = $row; diff --git a/libraries/relation.lib.php b/libraries/relation.lib.php index f6e1a3cd7..5dce1202f 100644 --- a/libraries/relation.lib.php +++ b/libraries/relation.lib.php @@ -429,10 +429,12 @@ function PMA_getComments($db, $table = '') { // MySQL 4.1.x native column comments if (PMA_MYSQL_INT_VERSION >= 40100) { $fields = PMA_DBI_get_fields($db, $table); - foreach($fields as $key=>$field) { - $tmp_col = $field['Field']; - if (!empty($field['Comment'])) { - $native_comment[$tmp_col] = $field['Comment']; + if ($fields) { + foreach($fields as $key=>$field) { + $tmp_col = $field['Field']; + if (!empty($field['Comment'])) { + $native_comment[$tmp_col] = $field['Comment']; + } } } }