Don't hexify BLOB if it is empty (bug #741599).

This commit is contained in:
Michal Čihař
2003-05-22 09:58:52 +00:00
parent 8a68abfc15
commit 1ccd69980a
4 changed files with 10 additions and 6 deletions

View File

@@ -8,6 +8,9 @@ $Source$
2003-05-22 Michal Cihar <nijel@users.sourceforge.net> 2003-05-22 Michal Cihar <nijel@users.sourceforge.net>
* tbl_indexes.php3, libraries/common.lib.php3: Better tabs highlighting * tbl_indexes.php3, libraries/common.lib.php3: Better tabs highlighting
when editing indexes. when editing indexes.
* tbl_replace_fields.php3, libraries/build_dump.lib.php3,
libraries/display_tbl.lib.php3: Don't hexify BLOB if it is empty (bug
#741599).
2003-05-22 Garvin Hicking <me@supergarv.de> 2003-05-22 Garvin Hicking <me@supergarv.de>
* sql.php3, libraries/common.lib.php3: Bug #692854: Never execute * sql.php3, libraries/common.lib.php3: Bug #692854: Never execute

View File

@@ -327,8 +327,8 @@ if (!defined('PMA_BUILD_DUMP_LIB_INCLUDED')){
// a number // a number
if ($field_num[$j]) { if ($field_num[$j]) {
$values[] = $row[$j]; $values[] = $row[$j];
// a blob // a not empty blob
} else if ($field_blob[$j]) { } else if ($field_blob[$j] && !empty($row[$j])) {
$values[] = '0x' . bin2hex($row[$j]); $values[] = '0x' . bin2hex($row[$j]);
// a string // a string
} else { } else {
@@ -465,7 +465,7 @@ if (!defined('PMA_BUILD_DUMP_LIB_INCLUDED')){
$type == 'bigint' ||$type == 'timestamp') { $type == 'bigint' ||$type == 'timestamp') {
$schema_insert .= $row[$j] . ', '; $schema_insert .= $row[$j] . ', ';
// blob // blob
} else if ($type == 'blob' || $type == 'mediumblob' || $type == 'largeblob' || $type == 'tinyblob') { } else if (($type == 'blob' || $type == 'mediumblob' || $type == 'largeblob' || $type == 'tinyblob') && !empty($row[$j])) {
$schema_insert .= '0x' . bin2hex($row[$j]) . ', '; $schema_insert .= '0x' . bin2hex($row[$j]) . ', ';
// a string // a string
} else { } else {

View File

@@ -961,8 +961,9 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
$condition .= 'IS NULL AND'; $condition .= 'IS NULL AND';
} else { } else {
if ($meta->type == 'blob' if ($meta->type == 'blob'
// hexify only if this is a true BLOB // hexify only if this is a true not empty BLOB
&& eregi('BINARY', $field_flags)) { && eregi('BINARY', $field_flags)
&& !empty($row[$pointer])) {
$condition .= 'LIKE 0x' . bin2hex($row[$pointer]). ' AND'; $condition .= 'LIKE 0x' . bin2hex($row[$pointer]). ' AND';
} else { } else {
$condition .= '= \'' . PMA_sqlAddslashes($row[$pointer], FALSE, TRUE) . '\' AND'; $condition .= '= \'' . PMA_sqlAddslashes($row[$pointer], FALSE, TRUE) . '\' AND';

View File

@@ -163,7 +163,7 @@ if (!$check_stop) {
// mode, insert empty field because no values were submitted. If protected // mode, insert empty field because no values were submitted. If protected
// blobs where set, insert original fields content. // blobs where set, insert original fields content.
if (isset($fieldlist)) { if (isset($fieldlist)) {
if (isset($prot_row) && isset($prot_row[$key]) && $prot_row[$key] != '') { if (isset($prot_row) && isset($prot_row[$key]) && !empty($prot_row[$key])) {
$val = '0x' . bin2hex($prot_row[$key]); $val = '0x' . bin2hex($prot_row[$key]);
$seen_binary = TRUE; $seen_binary = TRUE;
} else { } else {