Get the names of all the tables in the database.

@return string[] Returns an array of table names without prefixes.
972801
final public function fetchTableNames() {
        if ($this->tableNames !== null) {
            return array_values($this->tableNames);
        }

        $names = $this->fetchTableNamesDb();

        $this->tableNames = [];
        foreach ($names as $name) {
            $name = $this->stripPrefix($name);
            $this->tableNames[strtolower($name)] = $name;
        }

        return array_values($this->tableNames);
    }
1128208
public function getTables()
    {
        $tables = [];
        if ($this->serverSupportFeature(3)) {
            $result = $this->runMongoCommand(['listCollections' => 1]);
            foreach ($result as $val) {
                $tables[] = $val['name'];
            }
        } else {
            $result = $this->runMongoQuery('system.namespaces');
            foreach ($result as $val) {
                if (strpos($val['name'], '$') === false) {
                    $tables[] = substr($val['name'], strpos($val['name'], '.') + 1);
                }
            }
        }

        return $tables;
    }
102499
public function getNames()
    {
        $names = array_keys($this->getServices());
        $len = strlen(self::METHOD_PREFIX);
        foreach (get_class_methods($this) as $method) {
            if (Text::startsWith($method, self::METHOD_PREFIX)) {
                $name = lcfirst(substr($method, $len));
                if ($name) {
                    $names[] = $name;
                }
            }
        }
        return $names;
    }
567158
public static function getFromDB( )
    {
        $result = array();
        $objDB = \Database::getInstance( );

        $tables = $objDB->listTables( null, true );
        if( empty($tables) ) {
            return $result;
        }

        foreach( $tables as $table ) {
            $keys = array();
            $fields = $objDB->listFields($table, true);

            foreach( $fields as $field ) {
                $name = $field['name'];
                $field['name'] = '`' . $field['name'] . '`';

                if( in_array(strtolower($field['type']), array('text', 'tinytext', 'mediumtext', 'longtext')) && isset($fields[$name]) ) {
                    $keys[$name] = 'FULLTEXT ';
                }

                //--- Tabellenspalten definieren ---
                if( $field['type'] != 'index' ) {
                    unset($field['index']);

                    // Field type
                    if( isset($field['length']) && ($field['length'] != '') ) {
                        $field['type'] .= '(' . $field['length'] . ((isset($field['precision']) && $field['precision'] != '') ? ',' . $field['precision'] : '') . ')';

                        unset( $field['length'] );
                        unset( $field['precision'] );
                    }

                    // Variant collation
                    if( ($field['collation'] != '') && ($field['collation'] != $GLOBALS['TL_CONFIG']['dbCollation']) ) {
                        $field['collation'] = 'COLLATE ' . $field['collation'];
                    }
                    else {
                        unset( $field['collation'] );
                    }

                    // Default values
                    if( in_array(strtolower($field['type']), array('text', 'tinytext', 'mediumtext', 'longtext', 'blob', 'tinyblob', 'mediumblob', 'longblob')) || stristr($field['extra'], 'auto_increment') || ($field['default'] === null) || (strtolower($field['null']) == 'null') ) {
                        unset( $field['default'] );
                    }
                    // Date/time constants (see #5089)
                    else if( in_array(strtolower($field['default']), array('current_date', 'current_time', 'current_timestamp')) ) {
                        $field['default'] = "default " . $field['default'];
                    }
                    // Everything else
                    else {
                        $field['default'] = "default '" . $field['default'] . "'";
                    }

                    unset( $field['origtype'] );
                    $result[$table]['TABLE_FIELDS'][$name] = trim( implode( ' ', $field ) );
                }

                //--- Index-Einträge ---
                if( isset($field['index']) && !empty($field['index_fields']) ) {
                    $index_fields = '`' . implode( '`, `', $field['index_fields'] ) . '`';
                    $index_fields = str_replace(array('(', ')`'), array('`(', ')'), $index_fields );

                    switch( $field['index'] ) {
                        case 'UNIQUE':  if( $name == 'PRIMARY' ) {
                                            $result[$table]['TABLE_CREATE_DEFINITIONS'][$name] = 'PRIMARY KEY  ('.$index_fields.')';
                                        }
                                        else {
                                            $result[$table]['TABLE_CREATE_DEFINITIONS'][$name] = 'UNIQUE KEY `'.$name.'` ('.$index_fields.')';
                                        }
                                        break;

                        default:        $result[$table]['TABLE_CREATE_DEFINITIONS'][$name] = (isset($keys[$name]) ? $keys[$name] : '') . 'KEY `'.$name.'` ('.$index_fields.')';
                                        break;
                    }
                    unset( $field['index_fields'] );
                    unset( $field['index'] );
                }
            }
        }

        // Table status
        $objStatus = $objDB->execute( 'SHOW TABLE STATUS' );
        while( $zeile = $objStatus->fetchAssoc() ) {
            $result[$zeile['Name']]['TABLE_OPTIONS'] = ' ENGINE=' . $zeile['Engine'] . ' DEFAULT CHARSET=' . substr($zeile['Collation'], 0, strpos($zeile['Collation'],"_"));

            if( $zeile['Auto_increment'] != '' ) {
                $result[$zeile['Name']]['TABLE_OPTIONS'] .= ' AUTO_INCREMENT=' . $zeile['Auto_increment'];
            }
        }

        return $result;
    }
916285
public function listTableNames()
    {
        $sql = $this->_platform->getListTablesSQL();

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

        return $this->filterAssetNames($tableNames);
    }
1075169
public function showTables()
    {
        $sql = 'SHOW TABLES';
        $query = $this->pdo->prepare($sql);
        $query->execute();

        return $query->fetchAll(PDO::FETCH_ASSOC);
    }
90352
public function queriedTables()
    {
        $tables = array();

        foreach ($this->from as $key => $tableClause) {
            if (is_array($tableClause)) {
                $table = '"' . $tableClause['table'] . '"';
            } elseif (is_string($tableClause) && preg_match('/JOIN +("[^"]+") +(AS|ON) +/i', $tableClause, $matches)) {
                $table = $matches[1];
            } else {
                $table = $tableClause;
            }

            // Handle string replacements
            if ($this->replacementsOld) {
                $table = str_replace($this->replacementsOld, $this->replacementsNew, $table);
            }

            $tables[] = preg_replace('/^"|"$/', '', $table);
        }

        return $tables;
    }
59698
public function getSelectFields()
    {
        $fields = [];
        $uniqueList = [];

        $i = 0;

        foreach ($this->tables as $alias => $table) {
            if (!is_string($table['name'])) {
                continue;
            }

            $columns = $this->db->getTable($table['name'])->getColumns();

            foreach ($columns as $column) {
                $prefix = $table['prefix'];

                if ($i === 0) {
                    $prefix = $prefix !== null;
                } else {
                    $prefix = $prefix === null;
                }

                if ($prefix === true) {
                    $as = "{$alias}_{$column}";

                    if (!in_array($as, $uniqueList, true)) {
                        $uniqueList[] = $as;
                        $fields[] = $this->db->quoteName("{$alias}.{$column} AS $as");
                    }
                } else {
                    $uniqueList[] = $column;
                    $fields[] = $this->db->quoteName("{$alias}.{$column} AS {$column}");
                }
            }

            $i++;
        }

        return $fields;
    }
886742
public function getTableName()
    {
        if (null == $this->tableName) {
            $this->tableName = $this->determineTableName();
        }
        return $this->tableName;
    }
278904
protected function getTableNames(): array
    {
        $dbName = $this->config[DbItf::DB_CFG_DATABASE];
        $resp = $this->dbRunQuery(sprintf('SHOW FULL TABLES FROM `%s`', $dbName));

        $tableAndViewNames = [];
        while ($row = $resp->fetch_assoc()) {
            $tableAndViewNames[] = array_change_key_case($row);
        }

        return $tableAndViewNames;
    }
480461
public function getSortedTableNames()
    {
        $tables = [
            strtolower($this->table_one),
            strtolower($this->table_two),
        ];

        sort($tables);

        return $tables;
    }
315300
public function getTableColumns() : array
    {
        if (!$this->isTableNameSet()) {
            return [];
        }
        
        $sql = "SHOW COLUMNS FROM `".$this->tableName."`";
        $stmt = $this->db->query($sql);
        $arrResult = $stmt->fetchAll(PDO::FETCH_ASSOC);
        return $arrResult;
    }
478008
public function getTags()
    {
        // Get affected database and tables, add prefixes
        $database = $this->prefix($this->reflector->getDatabase(), self::PREFIX_DATABASE);

        // Get affected tables, don't add prefixes yet
        $tables = $this->reflector->getTables();

        // If rows should not be considered, we don't have to differ between specific and unspecific queries
        // We can simply prefix all tables with the database and return them
        if ($this->considerRows === false) {
            return $this->prefix($tables, $database);
        }

        // Get affected rows as multidimensional array per table
        $rows = $this->reflector->getRows();

        // Create the table tags with corresponding prefix
        // Depending on whether the queries are specific or not
        $tags = $this->getTableTags($tables, $rows);

        // Then we loop trough all these tags and add a tag for each row
        // Consisting of the prefixed table and the row with prefix
        foreach ($tables as $table) {

            if (!isset($rows[$table])) {
                continue;
            }

            $tablePrefix = $this->prefix($table, self::PREFIX_TABLE_SPECIFIC);
            $rowPrefix = $this->prefix(self::PREFIX_ROW, $tablePrefix);

            $tags = array_merge($tags, $this->prefix($rows[$table], $rowPrefix));
        }

        return $this->prefix($tags, $database);
    }
33403
public function getTables($database=null)
    {
        if (is_null($this->tables)) {
            $sql    = !empty($database) ? 'SHOW TABLES FROM '.$database : 'SHOW TABLES';
            $this->query($sql);
            $result = $this->fetchAll();
            foreach ($result as $v) {
                $this->tables[] = array_values($v)[0];
            }
        }
        return $this->tables;
    }
194029
public function getAllTables()
    {
        if (empty($this->_aTables)) {
            $tables = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->getAll("show tables");

            foreach ($tables as $tableInfo) {
                if ($this->validateTableName($tableInfo[0])) {
                    $this->_aTables[] = $tableInfo[0];
                }
            }
        }

        return $this->_aTables;
    }
1056634
public function getModelTables()
    {
        if ($this->tables === null) {
            $this->setModelTables($this->loadModelTables());
        }

        return $this->tables;
    }
1137453
public function getTableName() {
        if(empty($this->trueTableName)) {
            $tableName  = !empty($this->tablePrefix) ? $this->tablePrefix : '';
            if(!empty($this->tableName)) {
                $tableName .= $this->tableName;
            }else{
                $tableName .= parse_name($this->name);
            }
            $this->trueTableName    =   strtolower($tableName);
        }
        return (!empty($this->dbName)?$this->dbName.'.':'').$this->trueTableName;
    }