db_table_exists (public)
db_table_exists [ -dbn dbn ] table_name
Defined in packages/acs-tcl/tcl/01-database-procs.tcl
- Switches:
- -dbn (optional)
- The database name to use. If empty_string, uses the default database.
- Parameters:
- table_name (required)
- Returns:
- 1 if a table with the specified name exists in the database, otherwise 0.
- Authors:
- Don Baccus <dhogaza@pacifier.com>
- Lars Pind <lars@pinds.com>
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- datamodel__acs_object_type_check, object_type_table_name
Source code: set proc_name {db_table_exists} set driverkey [db_driverkey $dbn] switch -- $driverkey { oracle { set n_rows [db_string -dbn $dbn table_count { select count(*) from user_tables where table_name = upper(:table_name) }] } postgresql { set n_rows [db_string -dbn $dbn table_count { select count(*) from pg_class where relname = lower(:table_name) and relname !~ '^pg_' and relkind = 'r' }] } nsodbc - default { error "$proc_name is not supported for this database." } } return $n_rowsXQL Not present: Generic, PostgreSQL, Oracle