attribute::value_delete (public)

 attribute::value_delete attribute_id enum_value

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

deletes the specified enumeration value from the attribute. The net effect is that this attribute will have one fewer options for acceptable values.

Parameters:
attribute_id (required)
The attribute from which we are deleting
enum_value (required)
The value of we are deleting
Author:
Michael Bryzek <mbryzek@arsdigita.com>
Created:
12/2000

Testcases:
acs_subsite_attributes
Source code:
        # This function should remove all occurrences of the
        # attribute, but we don't do that now.

        if { ![db_0or1row select_last_sort_order {
            select sort_order as old_sort_order
              from acs_enum_values
             where attribute_id = :attribute_id
               and enum_value = :enum_value
        }] } {
            # nothing to delete
            return
        }

        db_dml delete_enum_value {
            delete from acs_enum_values
            where attribute_id = :attribute_id
            and enum_value = :enum_value
        }
        if { [db_resultrows] > 0 } {
            # update the sort order
            db_dml update_sort_order {
                update acs_enum_values
                   set sort_order = sort_order - 1
                 where attribute_id = :attribute_id
                   and sort_order > :old_sort_order
            }
        }

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

PostgreSQL XQL file:
packages/acs-subsite/tcl/attribute-procs-postgresql.xql

Oracle XQL file:
packages/acs-subsite/tcl/attribute-procs-oracle.xql

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