db_tables (public)
db_tables [ -pattern pattern ] [ -dbn dbn ]
Defined in packages/acs-tcl/tcl/01-database-procs.tcl
- Switches:
- -pattern (optional)
- Will be used as LIKE 'pattern%' to limit the number of tables returned.
- -dbn (optional)
- The database name to use. If empty_string, uses the default database.
- Returns:
- a Tcl list of all the tables owned by the connected user.
- Authors:
- Don Baccus <dhogaza@pacifier.com>
- Lars Pind <lars@pinds.com>
- Changelog:
- yon@arsdigita.com 20000711 changed to return lowercase table names
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set proc_name {db_tables} set driverkey [db_driverkey $dbn] switch -- $driverkey { oracle { set sql_table_names_with_pattern { select lower(table_name) as table_name from user_tables where table_name like upper(:pattern) } set sql_table_names_without_pattern { select lower(table_name) as table_name from user_tables } } postgresql { set sql_table_names_with_pattern { select relname as table_name from pg_class where relname like lower(:pattern) and relname !~ '^pg_' and relkind = 'r' } set sql_table_names_without_pattern { select relname as table_name from pg_class where relname !~ '^pg_' and relkind = 'r' } } nsodbc - default { error "$proc_name is not supported for this database." } } set tables [list] if { [info exists pattern] } { db_foreach -dbn $dbn table_names_with_pattern $sql_table_names_with_pattern { lappend tables $table_name } } else { db_foreach -dbn $dbn table_names_without_pattern $sql_table_names_without_pattern { lappend tables $table_name } } return $tablesXQL Not present: Generic, PostgreSQL, Oracle