db_column_exists (public)

 db_column_exists [ -dbn dbn ] table_name column_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)
column_name (required)
Returns:
1 if the row exists in the table, 0 if not.
Author:
Lars Pind <lars@pinds.com>

Partial Call Graph (max 5 caller/called nodes):
%3 test_acs_subsite_attributes acs_subsite_attributes (test acs-subsite) db_column_exists db_column_exists test_acs_subsite_attributes->db_column_exists db_string db_string (public) db_column_exists->db_string attribute::delete attribute::delete (public) attribute::delete->db_column_exists packages/schema-browser/www/column-comments-2.tcl packages/schema-browser/ www/column-comments-2.tcl packages/schema-browser/www/column-comments-2.tcl->db_column_exists

Testcases:
acs_subsite_attributes
Source code:
    set columns [list]

    # Works for both Oracle and PostgreSQL:
    set n_rows [db_string -dbn $dbn column_exists {
        select count(*)
        from user_tab_columns
        where table_name = upper(:table_name)
        and column_name = upper(:column_name)
    }]

    return [expr {$n_rows > 0}]
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ]
Show another procedure: