]> git.nbdom.net Git - nb.git/commitdiff
help
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 2 Aug 2016 23:05:52 +0000 (00:05 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 2 Aug 2016 23:05:52 +0000 (00:05 +0100)
lib/php/db.php

index 0269eea2ef1e8f4b10b5216d5d182dd731ad4604..bafa3bf593d2944a35c9487a0fcc91a29bb0e7b4 100644 (file)
@@ -356,6 +356,22 @@ class Db extends nb {
   }
 
   public function action($action,$table=null) {
+    $available = [
+      ['(db.)?help','This help'],
+      ['(db.)?dbs','List databases from conf'],
+      #['(db.)?dbs','List databases (name=* type=* all=1)'],
+      ['(db.)?tables','List tables (name=* type=* count=1 engine=*)'],
+
+      ['(table.)?rows','Dump one table, use format='],
+      ['(table.)?fields','List fields'],
+      ['table.infos','Table infos (count(*). Type, ...)'],
+      ['table.sql','Get the sql source'],
+
+      ['(table.)?insert','Insert a record'],
+      ['(table.)?update','Update a record'],
+      ['(table.)?delete','Delete a record'],
+
+    ];
     $actions = explode(',',$action);
     $this->pdef('format',($this->php_cli() ? 'csv' : ''));
     $rows = array();
@@ -364,21 +380,7 @@ class Db extends nb {
     foreach($actions as $action) {
 
         if ($action == 'db.help' or $action == 'help') {
-          $this->out(array(
-            array('[db.]help','This help'),
-            array('[db.]dbs','List databases'),
-            array('[db.]tables','List tables'),
-
-            array('[table.]rows','Dump one table, use format='),
-            array('[table.]fields','List fields'),
-            array('table.infos','Table infos (count(*). Type, ...)'),
-            array('table.sql','Get the sql source'),
-
-            array('[table.]insert','Insert a record'),
-            array('[table.]update','Update a record'),
-            array('[table.]delete','Delete a record'),
-
-          ),array('action','description'));
+          $this->out($available,['action','description']);
           $return = true;
 
         } elseif ($action == 'db.tables' or $action == 'tables') {
@@ -403,9 +405,9 @@ class Db extends nb {
           $return = $this->out(array_values($this->conf));
 
         } elseif ($action == 'db.dbs' or $action == 'dbs') {
-          if (self::p('hash') or self::p('all')) {
+          if (true or self::p('hash') or self::p('all')) {
 
-            $fields = ['id','name','host','type'];
+            $fields = ['name','title','type','host'];
             $dbs = [];
             $name = self::p('name','');
             $type = self::p('type','');