diff --git a/db_central_columns.php b/db_central_columns.php index 1aad6d6a30..696319df2f 100644 --- a/db_central_columns.php +++ b/db_central_columns.php @@ -117,17 +117,26 @@ $result = PMA_getColumnsList($db, $pos, $max_rows); $odd_row = false; $row_num=0; foreach ($result as $row) { - if (is_object(json_decode($row['col_extra']))) { - //Decode the json data of col_extra to col_extra and col_attribute - $row['col_extra'] = json_decode($row['col_extra'], true); + $vals = explode(',', $row['col_extra']); + + if (in_array('BINARY', $vals)) { + $row['col_attribute'] = 'BINARY'; + } elseif (in_array('UNSIGNED', $vals)) { + $row['col_attribute'] = 'UNSIGNED'; + } elseif (in_array('UNSIGNED ZEROFILL', $vals)) { + $row['col_attribute'] = 'UNSIGNED ZEROFILL'; + } elseif (in_array('on update CURRENT_TIMESTAMP', $vals)) { + $row['col_attribute'] = 'on update CURRENT_TIMESTAMP'; } else { - //it is not json string [FOR the case to handle previous inserted value] - //like extra column having only increment value,then to deal with it - $row['col_extra'] = array( - "col_extra" => $row['col_extra'], - "col_attribute" => "" - ); + $row['col_attribute'] = ''; } + + if (in_array('auto_increment', $vals)) { + $row['col_extra'] = 'auto_increment'; + } else { + $row['col_extra'] = ''; + } + $tableHtmlRow = PMA_getHTMLforCentralColumnsTableRow( $row, $odd_row, $row_num, $db ); diff --git a/js/functions.js b/js/functions.js index 0e01c7f919..b5e44a9269 100644 --- a/js/functions.js +++ b/js/functions.js @@ -2919,38 +2919,38 @@ function autoPopulate(input_id, offset) var db = PMA_commonParams.get('db'); var table = PMA_commonParams.get('table'); input_id = input_id.substring(0, input_id.length - 1); - $('#'+input_id+'1').val(central_column_list[db+'_'+table][offset].col_name); - var col_type = central_column_list[db+'_'+table][offset].col_type.toUpperCase(); - $('#'+input_id+'2').val(col_type); - $('#'+input_id+'3').val(central_column_list[db+'_'+table][offset].col_length); + $('#' + input_id + '1').val(central_column_list[db + '_' + table][offset].col_name); + var col_type = central_column_list[db + '_' + table][offset].col_type.toUpperCase(); + $('#' + input_id + '2').val(col_type); + $('#' + input_id + '3').val(central_column_list[db + '_' + table][offset].col_length); if(col_type === 'ENUM' || col_type === 'SET') { - $('#'+input_id+'3').next().show(); + $('#' + input_id + '3').next().show(); } else { - $('#'+input_id+'3').next().hide(); + $('#' + input_id + '3').next().hide(); } - var col_default = central_column_list[db+'_'+table][offset].col_default.toUpperCase(); + var col_default = central_column_list[db + '_' + table][offset].col_default.toUpperCase(); if (col_default !== '' && col_default !== 'NULL' && col_default !== 'CURRENT_TIMESTAMP') { - $('#'+input_id+'4').val("USER_DEFINED"); - $('#'+input_id+'4').next().next().show(); - $('#'+input_id+'4').next().next().val(central_column_list[db+'_'+table][offset].col_default); + $('#' + input_id + '4').val("USER_DEFINED"); + $('#' + input_id + '4').next().next().show(); + $('#' + input_id + '4').next().next().val(central_column_list[db + '_' + table][offset].col_default); } else { - $('#'+input_id+'4').val(central_column_list[db+'_'+table][offset].col_default); - $('#'+input_id+'4').next().next().hide(); + $('#' + input_id + '4').val(central_column_list[db + '_' + table][offset].col_default); + $('#' + input_id + '4').next().next().hide(); } - $('#'+input_id+'5').val(central_column_list[db+'_'+table][offset].col_collation); - $('#'+input_id+'6').val(central_column_list[db+'_'+table][offset].extra.col_attribute); - if(central_column_list[db+'_'+table][offset].extra.col_extra === 'on update CURRENT_TIMESTAMP') { - $('#'+input_id+'6').val(central_column_list[db+'_'+table][offset].extra.col_extra); + $('#' + input_id + '5').val(central_column_list[db + '_' + table][offset].col_collation); + $('#' + input_id + '6').val(central_column_list[db + '_' + table][offset].col_attribute); + if(central_column_list[db + '_' + table][offset].col_extra === 'on update CURRENT_TIMESTAMP') { + $('#' + input_id + '6').val(central_column_list[db + '_' + table][offset].col_extra); } - if(central_column_list[db+'_'+table][offset].extra.col_extra.toUpperCase() === 'AUTO_INCREMENT') { - $('#'+input_id+'9').prop("checked",true).change(); + if(central_column_list[db + '_' + table][offset].col_extra.toUpperCase() === 'AUTO_INCREMENT') { + $('#' + input_id + '9').prop("checked",true).change(); } else { - $('#'+input_id+'9').prop("checked",false); + $('#' + input_id + '9').prop("checked",false); } - if(central_column_list[db+'_'+table][offset].col_isNull !== '0') { - $('#'+input_id+'7').prop("checked",true); + if(central_column_list[db + '_' + table][offset].col_isNull !== '0') { + $('#' + input_id + '7').prop("checked",true); } else { - $('#'+input_id+'7').prop("checked",false); + $('#' + input_id + '7').prop("checked",false); } } @@ -3155,26 +3155,18 @@ AJAX.registerOnload('functions.js', function () { var list_size = central_column_list[db + '_' + table].length; var min = (list_size <= maxRows) ? list_size : maxRows; for (i = 0; i < min; i++) { - try { - central_column_list[db + '_' + table][i].extra = $.parseJSON(central_column_list[db + '_' + table][i].col_extra); - } catch (error) { - //it is not json encoded so make it [FOR the case to handle previous inserted values] - //like extra column having only increment value,then to deal with it - central_column_list[db + '_' + table][i].col_extra = '{"col_extra":"'+central_column_list[db + '_' + table][i].col_extra+'","col_attribute":""}'; - central_column_list[db + '_' + table][i].extra = $.parseJSON(central_column_list[db + '_' + table][i].col_extra); - } fields += '