Query for showing all tables

@param string|null $like The like pattern

@return Eden\Mysql\Utility
188368
public function showTables($like = null)
    {
        Argument::i()->test(1, 'string', 'null');
        
        $like = $like ? ' LIKE '.$like : null;
        $this->query = 'SHOW TABLES'.$like;
        return $this;
    }
955455
public function listTables($pattern = '/.*/')
    {
        $tables                 = [];
        $lastEvaluatedTableName = null;
        do {
            $args = [
                "Limit" => 30,
            ];
            if ($lastEvaluatedTableName) {
                $args['ExclusiveStartTableName'] = $lastEvaluatedTableName;
            }
            $cmd    = $this->db->getCommand(
                'ListTables',
                $args
            );
            $result = $this->db->execute($cmd);
            if (isset($result['LastEvaluatedTableName'])) {
                $lastEvaluatedTableName = $result['LastEvaluatedTableName'];
            }
            else {
                $lastEvaluatedTableName = null;
            }
            
            foreach ($result['TableNames'] as $tableName) {
                if (preg_match($pattern, $tableName)) {
                    $tables[] = $tableName;
                }
            }
        } while ($lastEvaluatedTableName != null);
        
        return $tables;
    }
36890
protected function checkQuery($query=null)
    {
        if ($query) {
            $this->getQuery()->set($query);
            unset($query);
        }
        
        $query = $this->getQuery();
        
        // if no table then set table
        if (!isset($query['table'])) {
            $query['table'] = $this->getTableName();
        }
        
        // use model database.table_prefix
        if (!isset($query['database']) && isset($this['database'])) {
            $query['database'] = $this['database'];
        }
        
        if (!isset($query['table_prefix']) && isset($this['table_prefix'])) {
            $query['table_prefix'] = $this['table_prefix'];
        }
        
        return static::formatQuery($query);
    }
1241633
public function get_tables($usecache=true) {
        if ($usecache and $this->tables !== null) {
            return $this->tables;
        }
        $this->tables = array();
        $prefix = str_replace('_', "\\_", strtoupper($this->prefix));
        $sql = "SELECT TABLE_NAME
                  FROM CAT
                 WHERE TABLE_TYPE='TABLE'
                       AND TABLE_NAME NOT LIKE 'BIN\$%'
                       AND TABLE_NAME LIKE '$prefix%' ESCAPE '\\'";
        $this->query_start($sql, null, SQL_QUERY_AUX);
        $stmt = $this->parse_query($sql);
        $result = oci_execute($stmt, $this->commit_status);
        $this->query_end($result, $stmt);
        $records = null;
        oci_fetch_all($stmt, $records, 0, -1, OCI_ASSOC);
        oci_free_statement($stmt);
        $records = array_map('strtolower', $records['TABLE_NAME']);
        foreach ($records as $tablename) {
            if ($this->prefix !== false && $this->prefix !== '') {
                if (strpos($tablename, $this->prefix) !== 0) {
                    continue;
                }
                $tablename = substr($tablename, strlen($this->prefix));
            }
            $this->tables[$tablename] = $tablename;
        }

        // Add the currently available temptables
        $this->tables = array_merge($this->tables, $this->temptables->get_temptables());

        return $this->tables;
    }
257029
public function getTables(string &$query) : array
    {
        $tables = [];
        foreach ($this->tables as &$table) {
            if (strpos($query, $table['table_name']) !== false) {
                $tables[] = $table['table_name'];
            }
        }

        unset($table);
        return $tables;
    }
133216
public function getTable($tablename) {
        $i = $this->findTableInArray($tablename);
        if ($i !== null) {
            return $this->tables[$i];
        }
        return null;
    }
1355759
public function getTablesForSql()
    {
        $tables = [];
        foreach ($this->tables as $table) {
            if (!$table->isSkipSql()) {
                $tables[] = $table;
            }
        }

        return $tables;
    }
1284520
public function listTables($limit = null, $exclusiveStartTableName = null)
    {
        if (null !== $this->logger) {
            $this->log('List tables');
        }

        $parameters = array();
        if (null !== $limit) {
            $parameters['Limit'] = $limit;
        }
        if (null !== $exclusiveStartTableName) {
            $parameters['ExclusiveStartTableName'] = $exclusiveStartTableName;
        }

        if (null !== $this->logger) {
            $this->log('ListTable request paramaters : '.print_r($parameters, true), Logger::DEBUG);
        }

        $response = $this->connector->listTables($parameters);

        if (null !== $this->logger) {
            $this->log('ListTable request response : '.print_r($response, true), Logger::DEBUG);
        }

        $tables = new Table\TableCollection((isset($response['LastEvaluatedTableName'])?$response['LastEvaluatedTableName']:null));
        if (!empty($response['TableNames'])) {
            foreach ($response['TableNames'] as $table) {
                $tables->add($table);
            }
        }
        return $tables;
    }
953861
public function fetchLikesCounters($likeableType, $likeType)
    {
        /** @var \Illuminate\Database\Eloquent\Builder $likesCount */
        $likesCount = app(LikeContract::class)
            ->select([
                DB::raw('COUNT(*) AS count'),
                'likeable_type',
                'likeable_id',
                'type_id',
            ])
            ->where('likeable_type', $likeableType);

        if (!is_null($likeType)) {
            $likesCount->where('type_id', $this->getLikeTypeId($likeType));
        }

        $likesCount->groupBy('likeable_id', 'type_id');

        return $likesCount->get()->toArray();
    }
685996
public function select(
        $table,
        $conditions = null,
        $fields = null,
        $order = null,
        $limit = null,
        $offset = null
    )
    {
        if (is_null($fields)) {
            $fields = "*";
        }

        $queryString = "SELECT {$fields} FROM {$table} ";

        if (!is_null($conditions)) {
            $queryString .= "WHERE {$conditions} ";
        }

        if (!is_null($order)) {
            $queryString .= "ORDER BY {$order} ";
        }

        if (!is_null($limit)) {
            $queryString .= "LIMIT {$limit} ";
        }

        if (!is_null($offset) && !is_null($limit)) {
            $queryString .= "OFFSET {$offset} ";
        }


        $queryString .= ";";

        $this->query($queryString);

        return $this->countRows();
    }
239678
public function GetCountLike($Table = '', $Like = FALSE) {
      if ($Table != '') {
         $this->MapAliases($Table);
         $this->From($Table);
      }

      if ($Like !== FALSE)
         $this->Like($Like);

      $this->Select('*', 'count', 'RowCount');
      $Result = $this->Query($this->GetSelect());

      $CountData = $Result->FirstRow();
      return $CountData->RowCount;
   }
457582
public function get_tables($usecache = true) {
        if ($usecache and $this->tables !== null) {
            return $this->tables;
        }
        $this->tables = array ();
        $prefix = str_replace('_', '\\_', $this->prefix);
        $sql = "SELECT table_name
                  FROM INFORMATION_SCHEMA.TABLES
                 WHERE table_name LIKE '$prefix%' ESCAPE '\\' AND table_type = 'BASE TABLE'";

        $this->query_start($sql, null, SQL_QUERY_AUX);
        $result = sqlsrv_query($this->sqlsrv, $sql);
        $this->query_end($result);

        if ($result) {
            while ($row = sqlsrv_fetch_array($result)) {
                $tablename = reset($row);
                if ($this->prefix !== false && $this->prefix !== '') {
                    if (strpos($tablename, $this->prefix) !== 0) {
                        continue;
                    }
                    $tablename = substr($tablename, strlen($this->prefix));
                }
                $this->tables[$tablename] = $tablename;
            }
            $this->free_result($result);
        }

        // Add the currently available temptables
        $this->tables = array_merge($this->tables, $this->temptables->get_temptables());
        return $this->tables;
    }
1342677
public function getTables()
    {
        // Get main table
        $tables = [$this->queryBuilder->from];

        // Add possible join tables
        $joins = $this->queryBuilder->joins ? : [];
        foreach ($joins as $join) {

            if (!in_array($join->table, $tables) && is_string($join->table)) {
                $tables[] = $join->table;
            }
        }

        return $tables;
    }
58527
public function getTables($like = null)
    {
        //Argument 1 must be a string or null
        Argument::i()->test(1, 'string', 'null');
        
        $query = $this->utility();
        $like = $like ? $this->bind($like) : null;
        $results = $this->query($query->showTables($like), $q->getBinds());
        $newResults = array();
        foreach ($results as $result) {
            foreach ($result as $key => $value) {
                $newResults[] = $value;
                break;
            }
        }
        
        return $newResults;
    }
71877
public function getFirstTable($tables=null)
    {
        if (!$tables) {
            $tables = static::getQuery()->get('table');
        }
        if ($tables) {
            if (is_string($tables)) {
                return DataHelper::explode(',\s*', $tables)[0];
            } elseif (is_array($tables)) {
                return static::getFirstTable(current($tables));
            }
        }
        
        return $tables;
    }
1199732
protected function getTableLikes($options, $credentials)
    {
        if ($options['fullDump'] === true || empty($options['ignoreTables']) === true) {
            return [];
        }
        $tablesLike = [];
        foreach ($options['ignoreTables'] as $table => $enabled) {
            if (!$enabled) {
                continue;
            }
            $tablesLike[] = 'Tables_in_' . $credentials['database'] . ' LIKE ' . escapeshellarg($table);
        }

        return $tablesLike;
    }
567869
public function getTables()
    {
        $query = Select::i()
            ->select('tablename')
            ->from('pg_tables')
            ->where("tablename NOT LIKE 'pg\\_%'")
            ->where("tablename NOT LIKE 'sql\\_%'")
            ->getQuery();
        
        return $this->query($query);
    }