@@ -737,7 +737,10 @@ public function getColumns() {
737
737
};
738
738
$ columns [$ i - 1 ] = new StdClass ();
739
739
$ columns [$ i - 1 ]->name = $ meta ['name ' ];
740
- $ columns [$ i - 1 ]->table = $ meta ['table ' ];
740
+ if (isset ($ meta ['table ' ]))
741
+ $ columns [$ i - 1 ]->table = $ meta ['table ' ];
742
+ else
743
+ $ columns [$ i - 1 ]->table = NULL ;
741
744
if (isset ($ meta ['mysql:decl_type ' ]))
742
745
$ columns [$ i - 1 ]->type = strtoupper ($ meta ['mysql:decl_type ' ]);
743
746
elseif (isset ($ meta ['sqlite:decl_type ' ])) {
@@ -803,21 +806,28 @@ public function dump($limit = 256, bool $columntypes = true, bool $print = true)
803
806
$ tables = [];
804
807
if ($ columns [0 ]) {
805
808
foreach ($ columns as $ k => $ v ) {
809
+ if ($ v ->table ===NULL ) {
810
+ $ tables = NULL ;
811
+ break ;
812
+ };
806
813
if (!in_array ($ v ->table , $ tables ))
807
814
$ tables [] = $ v ->table ;
808
815
};
809
- $ h .= "<caption> " ;
810
- $ h .= implode (", " , $ tables );
811
- $ h .= "</caption><tr> " ;
816
+ if ($ tables !==NULL && count ($ tables ) > 0 ) {
817
+ $ h .= "<caption> " ;
818
+ $ h .= implode (", " , $ tables );
819
+ $ h .= "</caption> " ;
820
+ };
821
+ $ h .= "<thead><tr> " ;
812
822
};
813
823
$ i = 0 ;
814
824
while ($ i ++ < $ this ->columnCount ) {
815
825
$ h .= "<th style= \"border: 1px solid black; padding: 5px; background-color: #ccf; \"> " ;
816
- if (count ($ tables ) > 1 )
826
+ if ($ tables !== NULL && count ($ tables ) > 1 )
817
827
$ h .= $ columns [$ i - 1 ]->table . ". " ;
818
828
if ($ columns [$ i - 1 ]) {
819
829
$ h .= $ columns [$ i - 1 ]->name ;
820
- if ($ columntypes ) {
830
+ if ($ columntypes && $ columns [ $ i - 1 ]-> type !== NULL ) {
821
831
$ h .= "<small style= \"opacity: .75 \"> – <em> " ;
822
832
$ h .= $ columns [$ i - 1 ]->type ;
823
833
$ h .= "</em></small> " ;
@@ -836,7 +846,7 @@ public function dump($limit = 256, bool $columntypes = true, bool $print = true)
836
846
$ h .= $ k ;
837
847
$ h .= "</th> " ;
838
848
};
839
- $ h .= "</tr> " ;
849
+ $ h .= "</tr></thead> " ;
840
850
};
841
851
if (count ($ f )==0 && $ this ->columnCount + count ($ this ->callbacks ) > 0 )
842
852
$ h .= "<tr><td colspan= \"" . $ this ->columnCount . "\" style= \"border: 1px solid black; padding: 5px; \"><em>No rows returned</em></td></tr> " ;
@@ -848,7 +858,7 @@ public function dump($limit = 256, bool $columntypes = true, bool $print = true)
848
858
$ h .= "<td style= \"border: 1px solid black; padding: 5px; text-align: center; \"> " . ($ val ===NULL ? "<em>NULL</em> " : ($ limit && (strlen ($ val ) > $ limit ) ? "<em>Value longer than " . $ limit . " bytes</em> " : ("<pre> " . (((!empty ($ columns [$ i ]) && $ columns [$ i ]->type =="BLOB " ) || !preg_match ("/^[\x{0020}-\x{007E}\x{00A0}-ſΑ-ωА-я‐- ⁰-₿℀-⋿①-⓿]*$/ " , $ val )) ? ("<strong>HEX: </strong><em> " . bin2hex ($ val ) . "</em> " ) : str_replace (["\n" , "\r" ], "" , nl2br (htmlspecialchars ($ val , ENT_QUOTES , "UTF-8 " )))) . "</pre> " ))) . "</td> " ;
849
859
$ i ++;
850
860
};
851
- $ h .= "<tr> " ;
861
+ $ h .= "</ tr> " ;
852
862
};
853
863
}
854
864
else
0 commit comments