Simplify getting table comment
- remove not needed word Show from method name - fix code to handle errors Signed-off-by: Michal Čihař <michal@cihar.com>
This commit is contained in:
parent
56046cc7e2
commit
b2bf9fba87
@ -240,7 +240,7 @@ class Menu
|
||||
$show_comment = null;
|
||||
} else {
|
||||
$tbl_is_view = false;
|
||||
$show_comment = $table_class_object->getShowComment();
|
||||
$show_comment = $table_class_object->getComment();
|
||||
}
|
||||
$retval .= $separator;
|
||||
if (Util::showIcons('TabsMode')) {
|
||||
|
||||
@ -339,11 +339,12 @@ class Table
|
||||
*
|
||||
* @return string Return comment info if it is set for the selected table or return blank.
|
||||
*/
|
||||
public function getShowComment() {
|
||||
public function getComment() {
|
||||
$table_comment = $this->getStatusInfo('COMMENT', false, true);
|
||||
if ($table_comment === false) {
|
||||
return isset($table_comment) ? $table_comment : '';
|
||||
return '';
|
||||
}
|
||||
return $table_comment;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -128,7 +128,7 @@ class TableChartController extends TableController
|
||||
} else {
|
||||
$tbl_is_view = false;
|
||||
$tbl_storage_engine = $table_class_object->getStorageEngine();
|
||||
$show_comment = $table_class_object->getShowComment();
|
||||
$show_comment = $table_class_object->getComment();
|
||||
}
|
||||
$tbl_collation = $table_class_object->getTableCollation();
|
||||
$table_info_num_rows = $table_class_object->getTableNumRowInfo();
|
||||
|
||||
@ -76,7 +76,7 @@ class TableIndexesController extends TableController
|
||||
} else {
|
||||
$tbl_is_view = false;
|
||||
$tbl_storage_engine = $table_class_object->getStorageEngine();
|
||||
$show_comment = $table_class_object->getShowComment();
|
||||
$show_comment = $table_class_object->getComment();
|
||||
}
|
||||
$tbl_collation = $table_class_object->getTableCollation();
|
||||
$table_info_num_rows = $table_class_object->getTableNumRowInfo();
|
||||
|
||||
@ -222,7 +222,7 @@ if ($reread_info) {
|
||||
} else {
|
||||
$tbl_is_view = false;
|
||||
$tbl_storage_engine = $pma_table->getStorageEngine();
|
||||
$show_comment = $pma_table->getShowComment();
|
||||
$show_comment = $pma_table->getComment();
|
||||
}
|
||||
$tbl_collation = $pma_table->getTableCollation();
|
||||
$table_info_num_rows = $pma_table->getTableNumRowInfo();
|
||||
|
||||
@ -1226,11 +1226,11 @@ class TableTest extends PMATestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for getShowComment
|
||||
* Test for getComment
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetShowComment(){
|
||||
public function testGetComment(){
|
||||
$target_table = 'table1';
|
||||
$target_db = 'pma_test';
|
||||
$tbl_object = new Table($target_db, $target_table);
|
||||
@ -1241,7 +1241,7 @@ class TableTest extends PMATestCase
|
||||
$show_comment = $dbi->getTable(
|
||||
$target_db,
|
||||
$target_table
|
||||
)->getShowComment();
|
||||
)->getComment();
|
||||
$this->assertEquals(
|
||||
$expect,
|
||||
$show_comment
|
||||
|
||||
Loading…
Reference in New Issue
Block a user