[browse] Properly display NULL value for BLOB.

This commit is contained in:
Michal Čihař
2010-01-22 17:19:07 +00:00
parent d435827ba5
commit 596bb4812d
2 changed files with 41 additions and 36 deletions

View File

@@ -29,6 +29,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
+ rfe #854911 [interface] Grey out non applicable actions in structure + rfe #854911 [interface] Grey out non applicable actions in structure
+ [interface] Allow to create new table from navigation frame (in light mode). + [interface] Allow to create new table from navigation frame (in light mode).
+ rfe #1025696 [browse] Add direct download of binary fields. + rfe #1025696 [browse] Add direct download of binary fields.
- [browse] Properly display NULL value for BLOB.
3.3.0.0 (not yet released) 3.3.0.0 (not yet released)
+ rfe #2308632 [edit] Use hex for (var)binary fields, + rfe #2308632 [edit] Use hex for (var)binary fields,

View File

@@ -1276,55 +1276,59 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
// TEXT fields type so we have to ensure it's really a BLOB // TEXT fields type so we have to ensure it's really a BLOB
$field_flags = PMA_DBI_field_flags($dt_result, $i); $field_flags = PMA_DBI_field_flags($dt_result, $i);
if (stristr($field_flags, 'BINARY')) { if (stristr($field_flags, 'BINARY')) {
// rajk - for blobstreaming if (!isset($row[$i]) || is_null($row[$i])) {
$vertical_display['data'][$row_no][$i] = ' <td align="right"' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '"><i>NULL</i></td>' . "\n";
} else {
// rajk - for blobstreaming
$bs_reference_exists = $allBSTablesExist = FALSE; $bs_reference_exists = $allBSTablesExist = FALSE;
// load PMA configuration // load PMA configuration
$PMA_Config = $GLOBALS['PMA_Config']; $PMA_Config = $GLOBALS['PMA_Config'];
// if PMA configuration exists // if PMA configuration exists
if ($PMA_Config) { if ($PMA_Config) {
// load BS variables // load BS variables
$pluginsExist = $PMA_Config->get('BLOBSTREAMING_PLUGINS_EXIST'); $pluginsExist = $PMA_Config->get('BLOBSTREAMING_PLUGINS_EXIST');
// if BS plugins exist // if BS plugins exist
if ($pluginsExist) { if ($pluginsExist) {
// load BS databases // load BS databases
$bs_tables = $PMA_Config->get('BLOBSTREAMABLE_DATABASES'); $bs_tables = $PMA_Config->get('BLOBSTREAMABLE_DATABASES');
// if BS db array and specified db string not empty and valid // if BS db array and specified db string not empty and valid
if (!empty($bs_tables) && strlen($db) > 0) { if (!empty($bs_tables) && strlen($db) > 0) {
$bs_tables = $bs_tables[$db]; $bs_tables = $bs_tables[$db];
if (isset($bs_tables)) { if (isset($bs_tables)) {
$allBSTablesExist = TRUE; $allBSTablesExist = TRUE;
// check if BS tables exist for given database // check if BS tables exist for given database
foreach ($bs_tables as $table_key=>$bs_tbl) foreach ($bs_tables as $table_key=>$bs_tbl)
if (!$bs_tables[$table_key]['Exists']) { if (!$bs_tables[$table_key]['Exists']) {
$allBSTablesExist = FALSE; $allBSTablesExist = FALSE;
break; break;
} }
}
} }
} }
} }
}
// if necessary BS tables exist // if necessary BS tables exist
if ($allBSTablesExist) { if ($allBSTablesExist) {
$bs_reference_exists = PMA_BS_ReferenceExists($row[$i], $db); $bs_reference_exists = PMA_BS_ReferenceExists($row[$i], $db);
} }
// if valid BS reference exists // if valid BS reference exists
if ($bs_reference_exists) { if ($bs_reference_exists) {
$blobtext = PMA_BS_CreateReferenceLink($row[$i], $db); $blobtext = PMA_BS_CreateReferenceLink($row[$i], $db);
} else { } else {
$blobtext = PMA_handle_non_printable_contents('BLOB', (isset($row[$i]) ? $row[$i] : ''), $transform_function, $transform_options, $default_function, $meta, $_url_params); $blobtext = PMA_handle_non_printable_contents('BLOB', (isset($row[$i]) ? $row[$i] : ''), $transform_function, $transform_options, $default_function, $meta, $_url_params);
} }
$vertical_display['data'][$row_no][$i] = ' <td align="left"' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '">' . $blobtext . '</td>'; $vertical_display['data'][$row_no][$i] = ' <td align="left"' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '">' . $blobtext . '</td>';
unset($blobtext); unset($blobtext);
}
// not binary: // not binary:
} else { } else {
if (!isset($row[$i]) || is_null($row[$i])) { if (!isset($row[$i]) || is_null($row[$i])) {