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>

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 ] | [ make this the default ]
Show another procedure: