$html_output = ''; // Set if we passed the first timestamp field $timestamp_seen = false; $columns_cnt = count($table_columns); $tabindex = 0; $tabindex_for_function = +3000; $tabindex_for_null = +6000; $tabindex_for_value = 0; $o_rows = 0; $biggest_max_file_size = 0; $url_params['db'] = $db; $url_params['table'] = $table; $url_params = PMA_urlParamsInEditMode($url_params, $where_clause_array, $where_clause); $has_blob_field = false; foreach ($table_columns as $column) { if (PMA_isColumn($column, array('blob', 'tinyblob', 'mediumblob', 'longblob'))) { $has_blob_field = true; break; } } //Insert/Edit form //If table has blob fields we have to disable ajax. $html_output .= PMA_getHtmlForInsertEditFormHeader($has_blob_field, $is_upload); $html_output .= URL::getHiddenInputs($_form_params); $titles['Browse'] = Util::getIcon('b_browse.png', __('Browse foreign values')); // user can toggle the display of Function column and column types // (currently does not work for multi-edits) if (!$cfg['ShowFunctionFields'] || !$cfg['ShowFieldTypesInDataEditView']) { $html_output .= __('Show'); } if (!$cfg['ShowFunctionFields']) {
/** * 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_isColumn * * @return void */ public function testIsColumn() { $column = array(); $types = array('binary', 'varbinary'); $column['Type'] = 'binaryfoo'; $this->assertTrue(PMA_isColumn($column, $types)); $column['Type'] = 'Binaryfoo'; $this->assertTrue(PMA_isColumn($column, $types)); $column['Type'] = 'varbinaryfoo'; $this->assertTrue(PMA_isColumn($column, $types)); $column['Type'] = 'barbinaryfoo'; $this->assertFalse(PMA_isColumn($column, $types)); $types = array('char', 'varchar'); $column['Type'] = 'char(10)'; $this->assertTrue(PMA_isColumn($column, $types)); $column['Type'] = 'VarChar(20)'; $this->assertTrue(PMA_isColumn($column, $types)); $column['Type'] = 'foochar'; $this->assertFalse(PMA_isColumn($column, $types)); $types = array('blob', 'tinyblob', 'mediumblob', 'longblob'); $column['Type'] = 'blob'; $this->assertTrue(PMA_isColumn($column, $types)); $column['Type'] = 'bloB'; $this->assertTrue(PMA_isColumn($column, $types)); $column['Type'] = 'mediumBloB'; $this->assertTrue(PMA_isColumn($column, $types)); $column['Type'] = 'tinyblobabc'; $this->assertTrue(PMA_isColumn($column, $types)); $column['Type'] = 'longblob'; $this->assertTrue(PMA_isColumn($column, $types)); $column['Type'] = 'foolongblobbar'; $this->assertFalse(PMA_isColumn($column, $types)); }