list databases and tables

@param array  $services services name list
@param string $table_pattern match table against a pattern
517645
public function listCommand($services = [], $table_pattern = '')
    {
        foreach ($services ?: $this->_getDbServices() as $service) {
            /** @var \ManaPHP\DbInterface $db */
            $db = $this->_di->getShared($service);

            $this->console->writeLn(['service: `:service`', 'service' => $service], Console::FC_CYAN);
            foreach ($this->_getTables($service, $table_pattern) as $row => $table) {
                $columns = (array)$db->getMetadata($table)[Db::METADATA_ATTRIBUTES];
                $primaryKey = $db->getMetadata($table)[Db::METADATA_PRIMARY_KEY];
                foreach ($columns as $i => $column) {
                    if (in_array($column, $primaryKey, true)) {
                        $columns[$i] = $this->console->colorize($column, Console::FC_RED);
                    }
                }

                $this->console->writeLn([' :row :table(:columns)',
                    'row' => sprintf('%2d ', $row + 1),
                    'table' => $this->console->colorize($table, Console::FC_GREEN),
                    'columns' => implode(', ', $columns)]);
            }
        }
    }
916285
public function listTableNames()
    {
        $sql = $this->_platform->getListTablesSQL();

        $tables     = $this->_conn->fetchAll($sql);
        $tableNames = $this->_getPortableTablesList($tables);

        return $this->filterAssetNames($tableNames);
    }
372556
protected function loadTableList()
    {
        if ($this->getDatabaseDriver() === 'sqlite') {
            $statement = "SELECT name FROM sqlite_master WHERE type='table';";
        } else {
            $statement = 'SHOW TABLES';
        }

        $tables = DB::select($statement);

        $this->tables = [];

        foreach ($tables as $tableObject) {

            $this->tables[] = array_get(array_values((array) $tableObject), '0');
        }
    }
1181034
public function getDbFields($table, $tablePrefix = null, $filter = 0)
    {
        is_null($tablePrefix) && $tablePrefix = $this->tablePrefix;
        $one = $this->runMongoQuery($tablePrefix . $table, [], ['limit' => 1]);
        return empty($one) ? [] : array_keys($one[0]);
    }
495236
public function listDatabases($condition = [], $options = [])
    {
        if ($this->databaseName === null) {
            $this->databaseName = 'admin';
        }
        $this->document = $this->db->getQueryBuilder()->listDatabases($condition, $options);

        $cursor = $this->execute();
        $result = current($cursor->toArray());

        if (empty($result['databases'])) {
            return [];
        }
        return $result['databases'];
    }
477890
public function getTableList()
    {
        // Set the query to get the tables statement.
        $this->setQuery($this->platform->getListTablesSQL());
        $tables = $this->loadColumn();

        return $tables;
    }
448769
protected function _list_tables($prefix_limit = FALSE)
	{
		$sql = 'SHOW TABLES FROM '.$this->escape_identifiers($this->database);

		if ($prefix_limit !== FALSE && $this->dbprefix !== '')
		{
			return $sql." LIKE '".$this->escape_like_str($this->dbprefix)."%'";
		}

		return $sql;
	}
345871
public function list_tables()
    {
        // get tables if not cached
        if ($this->tables === null) {
            // first fetch current database name
            $d = $this->query("SELECT database()");
            $d = $this->fetch_array($d);

            // get list of tables in current database
            $q = $this->query("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES"
                . " WHERE TABLE_SCHEMA = ? AND TABLE_TYPE = 'BASE TABLE'"
                . " ORDER BY TABLE_NAME", $d ? $d[0] : '');

            $this->tables = $q ? $q->fetchAll(PDO::FETCH_COLUMN, 0) : array();
        }

        return $this->tables;
    }
169028
def listTables(self, dbName=None):
        
        if dbName is None:
            dbName = self.currentDatabase()
        iter = self._jcatalog.listTables(dbName).toLocalIterator()
        tables = []
        while iter.hasNext():
            jtable = iter.next()
            tables.append(Table(
                name=jtable.name(),
                database=jtable.database(),
                description=jtable.description(),
                tableType=jtable.tableType(),
                isTemporary=jtable.isTemporary()))
        return tables
288862
protected function getTableIndexes($tableName = null, $connectionName = null)
    {
        $tableName = $this->validateTableName($tableName);

        return $this->getSchema($connectionName)->listTableIndexes($tableName);
    }
1241706
public function listTableNames()
    {
        $sql  = $this->_platform->getListTablesSQL();
        $sql .= ' AND CREATOR = UPPER(' . $this->_conn->quote($this->_conn->getUsername()) . ')';

        $tables = $this->_conn->fetchAll($sql);

        return $this->filterAssetNames($this->_getPortableTablesList($tables));
    }
33039
private static function _get_databases(): ?databases
  {
    if ( self::check() ){
      if ( !self::$databases_obj && ($db = self::_get_db()) ){
        self::$databases_obj = new databases($db);
      }
      return self::$databases_obj;
    }
    return null;
  }
87702
public static function getServicesList()
    {
        $map = [
          'GET' => 'get',
          'POST' => 'create',
          'PUT' => 'update',
          'DELETE' => 'delete',
        ];
        
        $table = new \Console_Table();
        $table->setHeaders(['Method', 'Type', 'Description', 'Parameters']);
        foreach (self::getServices() as $key => $service) {
            if ($service['type'] == 'entity') {
                foreach ($service['actions'] as $action) {
                    $table->addRow([
                        sprintf('xAC::%s()->%s()'
                            , $service['endpoint']
                            , $action['endpoint'] == 'default' ? $map[$action['method']] : $action['endpoint']
                            ), 
                        'entity/' . $action['type'], 
                        $action['description']
                    ]);
                }
            } else {
                $table->addRow(['xAC::' . $service['endpoint'] . '()->get()', $service['type'], $service['description']]);
            }
        }
        
        echo $table->getTable();
    }
827192
private function throwTableExceptions($tables, $requestedTables)
    {
        $foundTables = [];
        foreach ($tables as $table) {
            $foundTables[] = $table['name'];
        }

        foreach ($requestedTables as $requestedTable) {
            if (array_search($requestedTable, $foundTables) === false) {
                throw new exceptions\TableNotFoundException($requestedTable
                    ? "$requestedTable not found on target database."
                    : 'Please specify a table name.'
                );
            }
        }
    }
1095395
def list_services(kwargs=None, conn=None, call=None):
    '''
    
    '''
    if call != 'function':
        raise SaltCloudSystemExit(
            'The list_services function must be called with -f or --function.'
        )

    if not conn:
        conn = get_conn()

    data = conn.list_hosted_services()
    ret = {}
    for item in data.hosted_services:
        ret[item.service_name] = object_to_dict(item)
        ret[item.service_name]['name'] = item.service_name
    return ret
565812
def list_databases(self, instance, limit=None, marker=None):
        """"""
        return instance.list_databases(limit=limit, marker=marker)
154535
public function getTables($resultDetail = false)
    {
        $this->connect();
        $list = [];
        foreach ($this->tables as $db_name=>$tables)
        {
            foreach ($tables as $table_name=>$nodes)
            {

                if ($resultDetail)
                {
                    $list[$db_name . '.' . $table_name] = $nodes;
                } else
                {
                    $list[$db_name . '.' . $table_name] = array_keys($nodes);
                }
            }
        }
        return $list;
    }