/** * Check column names for MySQL reserved words * * @param string $db database name * @param string $table tablename * * @return array $messages array of PMA_Messages */ function PMA_getReservedWordColumnNameMessages($db, $table) { $messages = array(); if ($GLOBALS['cfg']['ReservedWordDisableWarning'] === false) { $pma_table = new PMA_Table($table, $db); $columns = $pma_table->getReservedColumnNames(); if (!empty($columns)) { foreach ($columns as $column) { $msg = PMA_message::notice(__('The column name \'%s\' is a MySQL reserved keyword.')); $msg->addParam($column); $messages[] = $msg; } } } return $messages; }
/** * Test for getColumns * * @return void */ public function testGetColumns() { $table = 'PMA_BookMark'; $db = 'PMA'; $table = new PMA_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); }
} /** * Gets the relation settings */ $cfgRelation = PMA_getRelationsParam(); /** * Runs common work */ require_once 'libraries/tbl_common.inc.php'; $url_query .= '&goto=tbl_structure.php&back=tbl_structure.php'; $url_params['goto'] = 'tbl_structure.php'; $url_params['back'] = 'tbl_structure.php'; // Check column names for MySQL reserved words if ($cfg['ReservedWordDisableWarning'] === false) { $pma_table = new PMA_Table($table, $db); $columns = $pma_table->getReservedColumnNames(); if (!empty($columns)) { foreach ($columns as $column) { $msg = PMA_message::notice(__('The column name \'%s\' is a MySQL reserved keyword.')); $msg->addParam($column); $response->addHTML($msg); } } } /** * Prepares the table structure display */ /** * Gets tables informations */ require_once 'libraries/tbl_info.inc.php';