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..91c9bd734d 100644
--- a/js/functions.js
+++ b/js/functions.js
@@ -2938,11 +2938,11 @@ function autoPopulate(input_id, offset)
$('#'+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+'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') {
+ 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);
@@ -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 += '
' +
escapeHtml(central_column_list[db + '_' + table][i].col_name) +
' ' + central_column_list[db + '_' + table][i].col_type;
- if (central_column_list[db + '_' + table][i].extra.col_attribute !== '') {
- fields += '(' + escapeHtml(central_column_list[db + '_' + table][i].extra.col_attribute) + ') ';
+ if (central_column_list[db + '_' + table][i].col_attribute !== '') {
+ fields += '(' + escapeHtml(central_column_list[db + '_' + table][i].col_attribute) + ') ';
}
if (central_column_list[db + '_' + table][i].col_length !== '') {
fields += '(' + escapeHtml(central_column_list[db + '_' + table][i].col_length) +') ';
}
- fields += escapeHtml(central_column_list[db + '_' + table][i].extra.col_extra) + '' +
+ fields += escapeHtml(central_column_list[db + '_' + table][i].col_extra) + '' +
' | ';
if (pick) {
fields += ' | ' +
central_column_list[db + '_' + table][i].col_name +
' ' +
central_column_list[db + '_' + table][i].col_type;
- if (central_column_list[db + '_' + table][i].extra.col_attribute !== '') {
- fields += '(' + central_column_list[db + '_' + table][i].extra.col_attribute + ') ';
+ if (central_column_list[db + '_' + table][i].col_attribute !== '') {
+ fields += '(' + central_column_list[db + '_' + table][i].col_attribute + ') ';
}
if (central_column_list[db + '_' + table][i].col_length !== '') {
fields += '(' + central_column_list[db + '_' + table][i].col_length + ') ';
}
- fields += central_column_list[db + '_' + table][i].extra.col_extra + '' +
+ fields += central_column_list[db + '_' + table][i].col_extra + '' +
' | ';
if (pick) {
fields += ' $column['col_extra'],
- "col_attribute" => ""
- );
+ $column['col_attribute'] = '';
}
- $query .= ' ' . $column['col_extra']['col_attribute'];
+
+ if (in_array('auto_increment', $vals)) {
+ $column['col_extra'] = 'auto_increment';
+ } else {
+ $column['col_extra'] = '';
+ }
+
+ $query .= ' ' . $column['col_attribute'];
if ($column['col_isNull']) {
$query .= ' NULL';
} else {
$query .= ' NOT NULL';
}
- $query .= ' ' . $column['col_extra']['col_extra'];
+ $query .= ' ' . $column['col_extra'];
if ($column['col_default']) {
if ($column['col_default'] != 'CURRENT_TIMESTAMP') {
$query .= ' DEFAULT \'' . PMA_Util::sqlAddSlashes(
@@ -538,12 +550,7 @@ function PMA_updateOneColumn($db, $orig_col_name, $col_name, $col_type,
. ', col_length = \'' . PMA_Util::sqlAddSlashes($col_length) . '\''
. ', col_isNull = ' . $col_isNull
. ', col_collation = \'' . PMA_Util::sqlAddSlashes($collation) . '\''
- . ', col_extra = \'' . json_encode(
- array(
- "col_extra" => $col_extra,
- "col_attribute" => $col_attribute
- )
- ) . '\''
+ . ', col_extra = \'' . implode(',', array($col_extra, $col_attribute)) . '\''
. ', col_default = \'' . PMA_Util::sqlAddSlashes($col_default) . '\''
. ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\' '
. 'AND col_name = \'' . PMA_Util::sqlAddSlashes($orig_col_name)
@@ -824,11 +831,11 @@ function PMA_getHTMLforCentralColumnsTableRow($row, $odd_row, $row_num, $db)
$tableHtml .=
' | '
. '' .
- ($row['col_extra']['col_attribute']
- ? htmlspecialchars($row['col_extra']['col_attribute']) : "" )
+ ($row['col_attribute']
+ ? htmlspecialchars($row['col_attribute']) : "" )
. ''
. PMA_getHtmlForColumnAttribute(
- $row_num, 4, 0, array(), $row['col_extra']['col_attribute'], false, null
+ $row_num, 4, 0, array(), $row['col_attribute'], false, null
)
. ' | ';
$tableHtml .=
@@ -840,11 +847,10 @@ function PMA_getHTMLforCentralColumnsTableRow($row, $odd_row, $row_num, $db)
$tableHtml .=
''
- . htmlspecialchars($row['col_extra']['col_extra']) . ''
+ . htmlspecialchars($row['col_extra']) . ''
. ''
+ . ''
. ' | ';
$meta = array();
if (!isset($row['col_default']) || $row['col_default'] == '') {