Skip to content

Commit

Permalink
bug #4734 Default values for binary fields do not support binary values
Browse files Browse the repository at this point in the history
Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
  • Loading branch information
madhuracj committed Jan 27, 2015
1 parent 963673e commit 6171c6c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Expand Up @@ -5,6 +5,7 @@ phpMyAdmin - ChangeLog
- bug #4728 Incorrect headings in routine editor
- bug #4730 Notice while browsing tables when phpmyadmin pma database exists, but not all the tables
- bug #4729 Display original field when using "Relational display column" option and display column is empty
- bug #4734 Default values for binary fields do not support binary values

4.3.8.0 (2015-01-24)
- bug Undefined constant PMA_DRIZZLE
Expand Down
2 changes: 2 additions & 0 deletions libraries/Table.class.php
Expand Up @@ -493,6 +493,8 @@ static function generateFieldSpec($name, $type, $index, $length = '',
$query .= ' DEFAULT \''
. PMA_Util::sqlAddSlashes($default_value) . '\'';
}
} elseif ($type == 'BINARY' || $type == 'VARBINARY') {
$query .= ' DEFAULT 0x' . $default_value;
} else {
$query .= ' DEFAULT \''
. PMA_Util::sqlAddSlashes($default_value) . '\'';
Expand Down
2 changes: 2 additions & 0 deletions libraries/insert_edit.lib.php
Expand Up @@ -1712,6 +1712,8 @@ function PMA_getSpecialCharsAndBackupFieldForInsertingMode(
|| $trueType == 'time'
) {
$special_chars = PMA_Util::addMicroseconds($column['Default']);
} elseif ($trueType == 'binary' || $trueType == 'varbinary') {
$special_chars = bin2hex($column['Default']);
} else {
$special_chars = htmlspecialchars($column['Default']);
}
Expand Down
6 changes: 3 additions & 3 deletions libraries/tbl_columns_definition_form.lib.php
Expand Up @@ -1120,11 +1120,11 @@ function PMA_getHtmlForColumnDefault($columnNumber, $ci, $ci_offset, $type_upper
&& isset($columnMeta['Default'])
) {
$columnMeta['Default'] = '';
}

if ($type_upper == 'BIT') {
} elseif ($type_upper == 'BIT') {
$columnMeta['DefaultValue']
= PMA_Util::convertBitDefaultValue($columnMeta['DefaultValue']);
} elseif ($type_upper == 'BINARY' || $type_upper == 'VARBINARY') {
$columnMeta['DefaultValue'] = bin2hex($columnMeta['DefaultValue']);
}

$html = '<select name="field_default_type[' . $columnNumber
Expand Down

0 comments on commit 6171c6c

Please sign in to comment.