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):
%3 test_datamodel__acs_object_type_check datamodel__acs_object_type_check (test acs-tcl) db_table_exists db_table_exists test_datamodel__acs_object_type_check->db_table_exists test_object_type_table_name object_type_table_name (test acs-tcl) test_object_type_table_name->db_table_exists db_driverkey db_driverkey (public) db_table_exists->db_driverkey db_string db_string (public) db_table_exists->db_string ad_verify_install ad_verify_install (public) ad_verify_install->db_table_exists fs::dav::require fs::dav::require (private) fs::dav::require->db_table_exists group_type::delete group_type::delete (public) group_type::delete->db_table_exists group_type::new group_type::new (public) group_type::new->db_table_exists packages/acs-core-docs/www/index.tcl packages/acs-core-docs/ www/index.tcl packages/acs-core-docs/www/index.tcl->db_table_exists

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_rows
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: