PMA\libraries\Table::getColumns PHP Method

getColumns() public method

returns an array with all columns
public getColumns ( boolean $backquoted = true, boolean $fullName = true ) : array
$backquoted boolean whether to quote name with backticks ``
$fullName boolean whether to include full name of the table as a prefix
return array
    public function getColumns($backquoted = true, $fullName = true)
    {
        $sql = 'SHOW COLUMNS FROM ' . $this->getFullName(true);
        $indexed = $this->_dbi->fetchResult($sql, 'Field', 'Field');
        return $this->_formatColumns($indexed, $backquoted, $fullName);
    }

Usage Example

Example #1
0
 /**
  * Test for getColumns
  *
  * @return void
  */
 public function testGetColumns()
 {
     $table = 'PMA_BookMark';
     $db = 'PMA';
     $table = new Table($table, $db);
     $return = $table->getColumns();
     $expect = array('`PMA`.`PMA_BookMark`.`column1`', '`PMA`.`PMA_BookMark`.`column3`', '`PMA`.`PMA_BookMark`.`column5`', '`PMA`.`PMA_BookMark`.`ACCESSIBLE`', '`PMA`.`PMA_BookMark`.`ADD`', '`PMA`.`PMA_BookMark`.`ALL`');
     $this->assertEquals($expect, $return);
     $return = $table->getReservedColumnNames();
     $expect = array('ACCESSIBLE', 'ADD', 'ALL');
     $this->assertEquals($expect, $return);
 }