PMA\libraries\Table::getColumnsMeta PHP Method

getColumnsMeta() public method

Get meta info for fields in table
public getColumnsMeta ( ) : mixed
return mixed
    public function getColumnsMeta()
    {
        $move_columns_sql_query = sprintf('SELECT * FROM %s.%s LIMIT 1', Util::backquote($this->_db_name), Util::backquote($this->_name));
        $move_columns_sql_result = $this->_dbi->tryQuery($move_columns_sql_query);
        if ($move_columns_sql_result !== false) {
            return $this->_dbi->getFieldsMeta($move_columns_sql_result);
        } else {
            // unsure how to reproduce but it was seen on the reporting server
            return array();
        }
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Test for getColumnsMeta
  *
  * @return void
  */
 public function testGetColumnsMeta()
 {
     $dbi = $this->getMockBuilder('PMA\\libraries\\DatabaseInterface')->disableOriginalConstructor()->getMock();
     $dbi->expects($this->once())->method('tryQuery')->with("SELECT * FROM `db`.`table` LIMIT 1")->will($this->returnValue('v1'));
     $dbi->expects($this->once())->method('getFieldsMeta')->with("v1")->will($this->returnValue('movecols'));
     $GLOBALS['dbi'] = $dbi;
     $tableObj = new Table('table', 'db');
     $this->assertEquals($tableObj->getColumnsMeta(), 'movecols');
 }