attribute::delete (public)

 attribute::delete attribute_id

Defined in packages/acs-subsite/tcl/attribute-procs.tcl

Delete the specified attribute id and all its values. This is irreversible. Returns 1 if the attribute was actually deleted. 0 otherwise.

Parameters:
attribute_id
Author:
Michael Bryzek <mbryzek@arsdigita.com>
Created:
12/2000

Partial Call Graph (max 5 caller/called nodes):
%3 test_acs_subsite_attributes acs_subsite_attributes (test acs-subsite) attribute::delete attribute::delete test_acs_subsite_attributes->attribute::delete db_0or1row db_0or1row (public) attribute::delete->db_0or1row db_column_exists db_column_exists (public) attribute::delete->db_column_exists db_exec_plsql db_exec_plsql (public) attribute::delete->db_exec_plsql attribute::value_delete attribute::value_delete (public) attribute::value_delete->attribute::delete packages/acs-subsite/www/admin/attributes/delete-2.tcl packages/acs-subsite/ www/admin/attributes/delete-2.tcl packages/acs-subsite/www/admin/attributes/delete-2.tcl->attribute::delete

Testcases:
acs_subsite_attributes
Source code:

        # 1. Drop the attribute with its column
        # 2. Return

        if { ![db_0or1row select_attr_info {
            select a.object_type, a.attribute_name,
            case when a.storage = 'type_specific' then t.table_name else a.table_name end as table_name,
            coalesce(a.column_name, a.attribute_name) as column_name
            from acs_attributes a, acs_object_types t
            where a.attribute_id = :attribute_id
            and t.object_type = a.object_type
        }] } {
            # Attribute doesn't exist
            return 0
        }

        if { $table_name eq "" || $column_name eq "" } {
            # We have to have both a nonempty table name and column name
            error "We do not have enough information to automatically remove this attribute. Namely, we are missing either the table name or the column name"
        }

        set drop_table_column_p [expr {[db_column_exists $table_name $column_name] ? "t" : "f"}]

        db_exec_plsql drop_attribute {}

        return 1
Generic XQL file:
packages/acs-subsite/tcl/attribute-procs.xql

PostgreSQL XQL file:
<fullquery name="attribute::delete.drop_attribute">
    <querytext>
    select acs_attribute__drop_attribute(:object_type, :attribute_name, :drop_table_column_p)
  </querytext>
</fullquery>
packages/acs-subsite/tcl/attribute-procs-postgresql.xql

Oracle XQL file:
<fullquery name="attribute::delete.drop_attribute">
    <querytext>
begin acs_attribute.drop_attribute(:object_type, :attribute_name, :drop_table_column_p); end;
</querytext>
</fullquery>
packages/acs-subsite/tcl/attribute-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: