/** * Analyze the table column array * * @param array $column description of column in given table * @param array $comments_map comments for every column that has a comment * @param boolean $timestamp_seen whether a timestamp has been seen * * @return array description of column in given table */ function PMA_analyzeTableColumnsArray($column, $comments_map, $timestamp_seen) { $column['Field_html'] = htmlspecialchars($column['Field']); $column['Field_md5'] = md5($column['Field']); // True_Type contains only the type (stops at first bracket) $column['True_Type'] = preg_replace('@\\(.*@s', '', $column['Type']); $column['len'] = preg_match('@float|double@', $column['Type']) ? 100 : -1; $column['Field_title'] = PMA_getColumnTitle($column, $comments_map); $column['is_binary'] = PMA_isColumn($column, array('binary', 'varbinary')); $column['is_blob'] = PMA_isColumn($column, array('blob', 'tinyblob', 'mediumblob', 'longblob')); $column['is_char'] = PMA_isColumn($column, array('char', 'varchar')); list($column['pma_type'], $column['wrap'], $column['first_timestamp']) = PMA_getEnumSetAndTimestampColumns($column, $timestamp_seen); return $column; }
/** * Test for PMA_getColumnTitle * * @return void */ public function testGetColumnTitle() { $column = array(); $column['Field'] = 'f1<'; $column['Field_html'] = 'f1<'; $this->assertEquals(PMA_getColumnTitle($column, array()), 'f1<'); $comments = array(); $comments['f1<'] = 'comment>'; $result = PMA_getColumnTitle($column, $comments); $this->assertContains('title="comment>"', $result); $this->assertContains('f1<', $result); }