From 74d329f02b58c5a65fa33ce06152da55e548c892 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Fri, 18 Aug 2006 12:18:45 +0000 Subject: [PATCH] do not display BLOBs on PDF export --- ChangeLog | 3 +++ libraries/export/pdf.php | 32 +++++++++++++++++++++++++------- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2e504a219..14a47dd68 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ phpMyAdmin - ChangeLog $Id$ $Source$ +2006-08-18 Marc Delisle + * libraries/export/pdf.php: do not display BLOBs on PDF export + 2006-08-16 Marc Delisle * libraries/sqlparser.lib.php: sorting on column header diff --git a/libraries/export/pdf.php b/libraries/export/pdf.php index 73ac4bc6c..1846370a1 100644 --- a/libraries/export/pdf.php +++ b/libraries/export/pdf.php @@ -164,9 +164,10 @@ class PMA_PDF extends PMA_FPDF foreach ($data as $col => $txt) { $this->page = $currpage; $this->SetXY($l, $h); - $this->MultiCell($this->tablewidths[$col], $lineheight, $txt, 0, $this->colAlign[$col]); - - $l += $this->tablewidths[$col]; + if ($this->tablewidths[$col] > 0) { + $this->MultiCell($this->tablewidths[$col], $lineheight, $txt, 0, $this->colAlign[$col]); + $l += $this->tablewidths[$col]; + } if (!isset($tmpheight[$row.'-'.$this->page])) { $tmpheight[$row.'-'.$this->page] = 0; @@ -237,17 +238,32 @@ class PMA_PDF extends PMA_FPDF $colFits[$i] = $stringWidth ; } $this->colTitles[$i] = $this->fields[$i]->name; + $this->display_column[$i] = true; + switch ($this->fields[$i]->type){ case 'int': $this->colAlign[$i] = 'R'; break; + case 'blob': + case 'tinyblob': + case 'mediumblob': + case 'longblob': + //TODO: do not deactivate completely the display + // but show the field's name and [BLOB] + if (stristr($this->fields[$i]->flags, 'BINARY')) { + $this->display_column[$i] = false; + unset($this->colTitles[$i]); + } + $this->colAlign[$i] = 'L'; + break; default: $this->colAlign[$i] = 'L'; } } - // loop through the data, any column whose contents is bigger i - // that the col size is resized + // loop through the data, any column whose contents is bigger + // than the col size is resized + // TODO: force here a LIMIT to avoid reading all rows while ($row = PMA_DBI_fetch_row($this->results)) { foreach ($colFits as $key => $val) { $stringWidth = $this->getstringwidth($row[$key]) + 6 ; @@ -257,7 +273,7 @@ class PMA_PDF extends PMA_FPDF } else { // if text is not bigger than the current column width setting enlarge the column if ($stringWidth > $val) { - $colFits[$key] = ($stringWidth) ; + $colFits[$key] = $stringWidth ; } } } @@ -276,10 +292,12 @@ class PMA_PDF extends PMA_FPDF if (!in_array($i, array_keys($colFits))) { $this->tablewidths[$i] = $this->sColWidth + ($surplus / ($this->numFields - sizeof($colFits))); } + if ($this->display_column[$i] == false) { + $this->tablewidths[$i] = 0; + } } ksort($this->tablewidths); - } PMA_DBI_free_result($this->results);