Simplify getting row format

- remove not needed word Table from method name
- fix code to handle errors
- convert existing users of getStatusInfo('ROW_FORMAT') to this method

Signed-off-by: Michal Čihař <michal@cihar.com>
This commit is contained in:
Michal Čihař 2017-03-06 09:50:19 +01:00
parent ca9ea74d20
commit a51ac4ef8b
5 changed files with 12 additions and 11 deletions

View File

@ -379,11 +379,12 @@ class Table
* @param Current table properties.
* @return Return table row format info if it is set for the selected table or return blank.
*/
public function getTableRowFormat() {
public function getRowFormat() {
$table_row_format = $this->getStatusInfo('ROW_FORMAT', false, true);
return isset($table_row_format)
? $table_row_format
: '';
if ($table_row_format === false) {
return '';
}
return $table_row_format;
}
/**

View File

@ -132,7 +132,7 @@ class TableChartController extends TableController
}
$tbl_collation = $table_class_object->getCollation();
$table_info_num_rows = $table_class_object->getNumRows();
$row_format = $table_class_object->getTableRowFormat();
$row_format = $table_class_object->getRowFormat();
$auto_increment = $table_class_object->getAutoIncrementInfo();
$create_options = $table_class_object->createOptionsArray();
} elseif (strlen($this->db) > 0) {

View File

@ -80,7 +80,7 @@ class TableIndexesController extends TableController
}
$tbl_collation = $table_class_object->getCollation();
$table_info_num_rows = $table_class_object->getNumRows();
$row_format = $table_class_object->getTableRowFormat();
$row_format = $table_class_object->getRowFormat();
$auto_increment = $table_class_object->getAutoIncrementInfo();
$create_options = $table_class_object->createOptionsArray();
$add_fields = 0;

View File

@ -158,7 +158,7 @@ if (isset($_REQUEST['submitoptions'])) {
$row_format = (isset($create_options['row_format']))
? $create_options['row_format']
: $pma_table->getStatusInfo('ROW_FORMAT');
: $pma_table->getRowFormat();
$table_alters = PMA_getTableAltersArray(
$pma_table,
@ -226,7 +226,7 @@ if ($reread_info) {
}
$tbl_collation = $pma_table->getCollation();
$table_info_num_rows = $pma_table->getNumRows();
$row_format = $pma_table->getTableRowFormat();
$row_format = $pma_table->getRowFormat();
$auto_increment = $pma_table->getAutoIncrementInfo();
$create_options = $pma_table->createOptionsArray();
}

View File

@ -1272,11 +1272,11 @@ class TableTest extends PMATestCase
}
/**
* Test for getTableRowFormat
* Test for getRowFormat
*
* @return void
*/
public function testGetTableRowFormat(){
public function testGetRowFormat(){
$target_table = 'table1';
$target_db = 'pma_test';
$tbl_object = new Table($target_db, $target_table);
@ -1287,7 +1287,7 @@ class TableTest extends PMATestCase
$row_format = $dbi->getTable(
$target_db,
$target_table
)->getTableRowFormat();
)->getRowFormat();
$this->assertEquals(
$expect,
$row_format