sb_get_tables (public)

 sb_get_tables selected_table_name

Defined in packages/schema-browser/tcl/schema-browser-procs-postgresql.tcl

Build an HTML table of all PG tables belonging to the current user. Each PG table name is returned as a hyperlink to a page which displays the table's structure.

Parameters:
selected_table_name

Partial Call Graph (max 5 caller/called nodes):
%3 packages/schema-browser/www/index.tcl packages/schema-browser/ www/index.tcl sb_get_tables sb_get_tables packages/schema-browser/www/index.tcl->sb_get_tables export_vars export_vars (public) sb_get_tables->export_vars sb_get_tables_list sb_get_tables_list (public) sb_get_tables->sb_get_tables_list

Testcases:
No testcase defined.
Source code:

    set n_columns 4
    set return_string ""

    set tables [sb_get_tables_list]
    if {[llength $tables] == 0} {
        return {No tables found. Make sure the owner of the tables in the
                database matches the user-id used by the web server to connect
                to the database.}
    }

    set n_rows [expr {([llength $tables] - 1) / $n_columns + 1}]

    append return_string "<table>"
    for { set row 0 } { $row < $n_rows } { incr row } {
         append return_string "<tr>"
         for {set column 0} {$column < $n_columns} {incr column} {
             set i_element [expr {$n_rows * $column + $row}]
             if { $i_element < [llength $tables] } {
                 set table_name [lindex $tables $i_element]
                 if { $table_name == $selected_table_name } {
                     append return_string "<td><b>[string tolower $table_name]</b></td>"
                 } else {
                     set href [export_vars -base index {table_name}]
                     append return_string [subst {<td><a href="[ns_quotehtml $href]">[string tolower $table_name]</a></td>}]

                 }
             }

         }
     append return_string "</tr>"
    }

    append return_string "</table>"

    return $return_string
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: