do not display BLOBs on PDF export

This commit is contained in:
Marc Delisle
2006-08-18 12:18:45 +00:00
parent e0b62c09ff
commit 74d329f02b
2 changed files with 28 additions and 7 deletions

View File

@@ -5,6 +5,9 @@ phpMyAdmin - ChangeLog
$Id$ $Id$
$Source$ $Source$
2006-08-18 Marc Delisle <lem9@users.sourceforge.net>
* libraries/export/pdf.php: do not display BLOBs on PDF export
2006-08-16 Marc Delisle <lem9@users.sourceforge.net> 2006-08-16 Marc Delisle <lem9@users.sourceforge.net>
* libraries/sqlparser.lib.php: sorting on column header * libraries/sqlparser.lib.php: sorting on column header

View File

@@ -164,9 +164,10 @@ class PMA_PDF extends PMA_FPDF
foreach ($data as $col => $txt) { foreach ($data as $col => $txt) {
$this->page = $currpage; $this->page = $currpage;
$this->SetXY($l, $h); $this->SetXY($l, $h);
$this->MultiCell($this->tablewidths[$col], $lineheight, $txt, 0, $this->colAlign[$col]); if ($this->tablewidths[$col] > 0) {
$this->MultiCell($this->tablewidths[$col], $lineheight, $txt, 0, $this->colAlign[$col]);
$l += $this->tablewidths[$col]; $l += $this->tablewidths[$col];
}
if (!isset($tmpheight[$row.'-'.$this->page])) { if (!isset($tmpheight[$row.'-'.$this->page])) {
$tmpheight[$row.'-'.$this->page] = 0; $tmpheight[$row.'-'.$this->page] = 0;
@@ -237,17 +238,32 @@ class PMA_PDF extends PMA_FPDF
$colFits[$i] = $stringWidth ; $colFits[$i] = $stringWidth ;
} }
$this->colTitles[$i] = $this->fields[$i]->name; $this->colTitles[$i] = $this->fields[$i]->name;
$this->display_column[$i] = true;
switch ($this->fields[$i]->type){ switch ($this->fields[$i]->type){
case 'int': case 'int':
$this->colAlign[$i] = 'R'; $this->colAlign[$i] = 'R';
break; 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: default:
$this->colAlign[$i] = 'L'; $this->colAlign[$i] = 'L';
} }
} }
// loop through the data, any column whose contents is bigger i // loop through the data, any column whose contents is bigger
// that the col size is resized // than the col size is resized
// TODO: force here a LIMIT to avoid reading all rows
while ($row = PMA_DBI_fetch_row($this->results)) { while ($row = PMA_DBI_fetch_row($this->results)) {
foreach ($colFits as $key => $val) { foreach ($colFits as $key => $val) {
$stringWidth = $this->getstringwidth($row[$key]) + 6 ; $stringWidth = $this->getstringwidth($row[$key]) + 6 ;
@@ -257,7 +273,7 @@ class PMA_PDF extends PMA_FPDF
} else { } else {
// if text is not bigger than the current column width setting enlarge the column // if text is not bigger than the current column width setting enlarge the column
if ($stringWidth > $val) { 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))) { if (!in_array($i, array_keys($colFits))) {
$this->tablewidths[$i] = $this->sColWidth + ($surplus / ($this->numFields - sizeof($colFits))); $this->tablewidths[$i] = $this->sColWidth + ($surplus / ($this->numFields - sizeof($colFits)));
} }
if ($this->display_column[$i] == false) {
$this->tablewidths[$i] = 0;
}
} }
ksort($this->tablewidths); ksort($this->tablewidths);
} }
PMA_DBI_free_result($this->results); PMA_DBI_free_result($this->results);