Prado\Data\Common\Oracle\TOracleMetaData::findTableNames PHP Method

findTableNames() public method

Returns all table names in the database.
public findTableNames ( string $schema = '' ) : array
$schema string the schema of the tables. Defaults to empty string, meaning the current or default schema. If not empty, the returned table names will be prefixed with the schema name.
return array all table names in the database.
    public function findTableNames($schema = '')
    {
        if ($schema === '') {
            $sql = <<<EOD
SELECT table_name, '{$schema}' as table_schema FROM user_tables
EOD;
            $command = $this->getDbConnection()->createCommand($sql);
        } else {
            $sql = <<<EOD
SELECT object_name as table_name, owner as table_schema FROM all_objects
WHERE object_type = 'TABLE' AND owner=:schema
EOD;
            $command = $this->getDbConnection()->createCommand($sql);
            $command->bindParam(':schema', $schema);
        }
        $rows = $command->queryAll();
        $names = array();
        foreach ($rows as $row) {
            if ($schema === $this->getDefaultSchema() || $schema === '') {
                $names[] = $row['TABLE_NAME'];
            } else {
                $names[] = $row['TABLE_SCHEMA'] . '.' . $row['TABLE_NAME'];
            }
        }
        return $names;
    }