xo::db::require proc exists_column (public)
xo::db::requireexists_column table_name column_name
Defined in /var/www/openacs/packages/xotcl-core/tcl/05-db-procs.tcl
Check whether a table contains a column.
- Parameters:
- table_name (required)
- Table to inspect.
- column_name (required)
- Column to look up.
- Returns:
- Whether the column exists.
- Testcases:
- xotcl_core_tutorial_2
Source code: # # The following "try" operation is a transitional code: When # someone upgrades from OpenACS 5.9.1 to OpenACS 5.10, and the # upgrade script of 5.10 were not yet executed, the SQL function # definition is still the one of 5.9.1 have no -p_table and # p_column attributes defined (still the old names). A end user is # lost in this situation. Therefore, we provide as a fallback the # interface to the 5.9.1 parameter names. The situation is still a # problem in OpenACS 5.10, since the Oracle code has still the old # names. Therefore, for OpenACS 5.10.1, the names are made more # consistent, using "table_name" (abbreviated as table) and # "column" as on several other occasions. # try { ::acs::dc call util table_column_exists -table $table_name -column $column_name } on error {errorMsg} { try { ::acs::dc call util table_column_exists -t_name $table_name -c_name $column_name } on error {errorMsg} { ::acs::dc call util table_column_exists -p_table $table_name -p_column $column_name } }XQL Not present: Generic, PostgreSQL, Oracle
![[i]](/resources/acs-subsite/ZoomIn16.gif)