PDO4You\Describe::showMsSqlTables PHP Method

showMsSqlTables() private static method

Microsoft SQL Server method to display the tables of the database
private static showMsSqlTables ( string $schema ) : void
$schema string Name of scheme
return void
    private static function showMsSqlTables($schema)
    {
        Singleton::setStyle();
        $table_schema = !is_null($schema) ? "table_schema = '" . $schema . "'" : "table_schema IS NOT NULL";
        $tables = Singleton::select("SELECT table_catalog, table_schema, table_name FROM information_schema.tables WHERE table_type = 'BASE TABLE' AND " . $table_schema . ";");
        $database = $tables[0]['table_catalog'];
        $html = '<div class="pdo4you">';
        $html .= '<strong>Database:</strong> ' . $database . ' &nbsp;<strong>Total of tables:</strong> ' . count($tables) . '<br />';
        foreach ($tables as $k1 => $v1) {
            $desc = Singleton::select("SELECT table_catalog, table_schema, table_name, column_name AS field, data_type AS type FROM information_schema.columns WHERE table_catalog = '" . $v1['table_catalog'] . "' AND table_name = '" . $v1['table_name'] . "';");
            $html .= '<div class="code title">Table: <span>' . $v1['table_schema'] . '.' . $v1['table_name'] . '</span></div>';
            $html .= '<div class="code trace">';
            foreach ($desc as $k2 => $v2) {
                $html .= '<div class="number">&nbsp;</div> <span><i style="color:#00B;">' . $v2['field'] . "</i> - " . strtoupper($v2['type']) . '</span><br />';
            }
            $html .= '</div>';
        }
        $html .= '</div>';
        echo $html;
    }