}
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();
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') {
$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','');