From: Nicolas Boisselier Date: Mon, 7 Mar 2016 04:03:45 +0000 (+0000) Subject: Bed ! X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=9b6b521c7eef2b001dbb02526e81f2556054df4b;p=nb.git Bed ! --- diff --git a/lib/php/db.php b/lib/php/db.php index b61bcbe1..af9e3a95 100644 --- a/lib/php/db.php +++ b/lib/php/db.php @@ -509,6 +509,7 @@ EOF; array('db.count','Tables count(*)'), array('[db.]html_menu','Html menu for tables with links'), + array('[table.]rows','Dump one table, use format='), array('[table.]fields','List fields'), array('table.count','Table count(*)'), array('table.sql','Get the sql source'), diff --git a/lib/php/db/table.php b/lib/php/db/table.php index b4a14e4c..0e0fd1b6 100644 --- a/lib/php/db/table.php +++ b/lib/php/db/table.php @@ -757,15 +757,15 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog. -----------------------------------------------------------------*/ function rows_begin_xml() { return '' - .''.PHP_EOL #'.PHP_EOL #db->name.'" table="'.$this->name.'" type="'.$this->db->type.'">'.PHP_EOL - .''.PHP_EOL + .''.PHP_EOL ; } function rows_rec_xml(&$row) { $xml = ''; - $xml .= "\t".PHP_EOL; + $xml .= "\t".PHP_EOL; foreach ($row as $k=>$v) { if ($v !== '') $xml .= '' . "\t\t<".$k.">" @@ -773,12 +773,12 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog. . '' .PHP_EOL; } - $xml .= "\t".PHP_EOL; + $xml .= "\t".PHP_EOL; return $xml; } function rows_end_xml() { - return '
'.PHP_EOL; + return ''.PHP_EOL; } /*----------------------------------------------------------------- @@ -1024,6 +1024,7 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog. } elseif ($action == 'table.rows' or $action == 'rows') { #if ($this->p('page')==='0') $this->pset('inc',1); + $this->db->print_header($this->p('format')); $this->rows(); return true; # NB 06.03.16 } elseif ($action == 'table') { diff --git a/lib/php/out.php b/lib/php/out.php index c28c0551..987a61a4 100644 --- a/lib/php/out.php +++ b/lib/php/out.php @@ -18,6 +18,13 @@ class Out extends Nb { 'head' => 'out_csv_head', 'function' => 'out_csv', ), + 'labels' => array( + 'enclose' => array("
".OUT_EOL,"
"), + 'tag_enclose' => 'labels', + 'tag' => 'label', + 'function' => 'out_tag', + 'head' => 'out_tag_head', + ), 'table' => array( 'enclose' => array("".OUT_EOL,"
"), 'tag_enclose' => 'tr', @@ -148,7 +155,7 @@ function out_csv_head(&$row,$o) { #function out_tag_head(&$row,$o) { return ''; } function out_tag_head(&$data,$o) { #return var_dump($row,true); return ''; - $o['tag'] = $o['tag_head']; + $o['tag'] = isset($o['tag_head']) ? $o['tag_head'] : $o['tag']; $row = out::ar_first($data); if (!out::is_hash($row)) $row = $data; #if (!is_array($row)) return out_csv(array_fill(0,count($row),'?'));