]> git.nbdom.net Git - nb.git/commitdiff
mysql table.sql.index
authorNico Boisselier <nico@dhcp-192-168-4-150.semantico.net>
Thu, 27 Oct 2016 10:52:31 +0000 (11:52 +0100)
committerNico Boisselier <nico@dhcp-192-168-4-150.semantico.net>
Thu, 27 Oct 2016 10:52:31 +0000 (11:52 +0100)
lib/php/db.php
lib/php/db/table.php
lib/php/db/types/mysql.php

index 514ea6eec48a2cbf78524b4af26cd425daf82147..df7542a5346833fafdfc0c1d22a7b567aa24e05a 100644 (file)
@@ -62,6 +62,7 @@ class Db extends nb {
     'databases' => 'db.databases',
 
     'tables' => 'db.tables',
+    'help' => 'db.help',
     'fields' => 'table.fields',
     'rows' => 'table.rows',
     'insert' => 'table.insert',
@@ -506,7 +507,7 @@ class Db extends nb {
 
     foreach($actions as $action) {
 
-        if ($action == 'db.help' or $action == 'help') {
+        if ($action == 'db.help') {
           $this->out($available,['action','description']);
           $return = true;
 
@@ -524,11 +525,10 @@ class Db extends nb {
             'count' => $count,
           ]);
 
-        } elseif ($action == 'db.tables' or $action == 'tables') {
+        } elseif ($action == 'db.tables') {
           # Filters
           $type = $this->p('type','');
           $name = $this->p('name','');
-          #if ($count = $this->p('count','')) $this->pset('count',1);
           $engine = $this->p('engine','');
 
           #var_dump ($this->tables());
index 075dc817759954316130d4db01b5db6179fe93c3..843cdf1c5705483f6251ecfc936a73165d55777d 100644 (file)
@@ -1398,13 +1398,6 @@ Class Table extends nb {
 
   public function action($action=null) {
     if ($action === null) $action = $this->p('action');
-# NB 23.05.16     $aliases = function($search) {
-# NB 23.05.16       foreach ([
-# NB 23.05.16         [ 'table.fields', 'fields' ],
-# NB 23.05.16       ] as $k=>$v) {
-# NB 23.05.16         if ($k === $search or $v === $search) return $k;
-# NB 23.05.16       }
-# NB 23.05.16     };
 
     if ($action == 'table.fields') {
       $rows = array_values($this->object2array($this->fields()));
index bcc6ff2f2a08d48e72d2261f67f17bd365715e81..6f448d20bb9ca76af0ebbd3b90d26ac968a8c01d 100644 (file)
@@ -15,7 +15,7 @@ $DB_TYPES['mysql'] = array (
 'file2table' => "LOAD DATA INFILE '<FILE> REPLACE INTO TABLE '<T.NAME>' TERMINATED BY '\\t' ENCLOSED BY '' LINES TERMINATED BY '\\r\\n' IGNORE 0 LINES",
 
 'table.sql' => 'SHOW CREATE TABLE `<T.NAME>`',
-'table.sql.index' => "SELECT ".(Db::p('db.type') ? "CONCAT(s.TABLE_NAME,'_',s.INDEX_NAME,'_idx')" : 's.INDEX_NAME')." as name,(CASE NON_UNIQUE WHEN 1 THEN 0 ELSE 1 END) as uniqe,GROUP_CONCAT(COLUMN_NAME) as field FROM INFORMATION_SCHEMA.STATISTICS s LEFT OUTER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS t ON t.TABLE_SCHEMA=s.TABLE_SCHEMA AND t.TABLE_NAME=s.TABLE_NAME  AND s.INDEX_NAME=t.CONSTRAINT_NAME  WHERE 0=0 AND t.CONSTRAINT_NAME IS NULL AND s.TABLE_SCHEMA = DATABASE() AND s.TABLE_NAME='<T.NAME>' GROUP BY name ORDER BY SEQ_IN_INDEX",
+'table.sql.index' => "SELECT ".(Db::p('db.type') ? "CONCAT(s.TABLE_NAME,'_',s.INDEX_NAME,'_idx')" : 's.INDEX_NAME')." as name,(CASE NON_UNIQUE WHEN 1 THEN 0 ELSE 1 END) as uniqe,GROUP_CONCAT(COLUMN_NAME) as field FROM INFORMATION_SCHEMA.STATISTICS s LEFT OUTER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS t ON t.TABLE_SCHEMA=s.TABLE_SCHEMA AND t.TABLE_NAME=s.TABLE_NAME  AND s.INDEX_NAME=t.CONSTRAINT_NAME  WHERE 0=0 AND t.CONSTRAINT_NAME IS NULL AND s.TABLE_SCHEMA = DATABASE() AND s.TABLE_NAME='<T.NAME>' GROUP BY name,uniqe,SEQ_IN_INDEX ORDER BY SEQ_IN_INDEX",
 # NB 04.07.16 '_table.sql.index' => [
 # NB 04.07.16   'SHOW INDEX FROM `<T.NAME>`', function(&$r) {
 # NB 04.07.16     if ($r['Key_name'] != 'PRIMARY') return [