PMA_DisplayResults class will contain the functions specific to the displaying
query results and handling special tables like `PROCESSLIST` which provides informations on current threads running in PMA. At the current code base, these functions are
appeared as global functions inside display_tbl.lib.php file. After
introducing PMA_DisplayResults class instead of this set of functions, the file
will be renamed as DisplayResults.class.php .
Class diagram (not the completed one) for the PMA_DisplayResults class
Following code snippet represent some rough implementation of the PMA_DisplayResults class,
class PMA_DisplayResults { const DIRECTION_LEFT = 'left'; const DIRECTION_VERTICAL = 'vertical'; private $_db; private $_table; public function __construct($db, $table) { $this->_db = $db; $this->_table = $table; } public function getTable() { // Related code for getTable function $str .= $this->_getTableHeaders(); // end of the related code } private function _getTableHeaders() { //code... $msg = PMA_getMessage($this->_db, $this->_table); //code... } }
As the only outsider accessed Display class, the sql.php file will be use,
// inside sql.php file $displayResultsObj = new PMA_DisplayResults($GLOBALS['db'], $GLOBALS['table']); echo $displayResultsObj->getTable();