acs_sc::contract::delete (public)

 acs_sc::contract::delete [ -contract_id contract_id ] [ -name name ] \
    [ -no_cascade ]

Defined in packages/acs-service-contract/tcl/contract-procs.tcl

Delete a service contract definition. Supply either contract_id or name.

Switches:
-contract_id (optional)
The ID of the service contract to delete
-name (optional)
Name of the service contract to delete
-no_cascade (optional, boolean)

Testcases:
acs_sc_impl_new_from_spec
Source code:
    if { $contract_id eq "" && $name eq "" } {
        error "You must supply either name or contract_id"
    }

    db_transaction {
        # Need both name and ID below
        if { $name eq "" } {
            set name [db_string get_name_by_id {
                select contract_name
                from acs_sc_contracts
                where contract_id = :contract_id
            }]
        } elseif$contract_id eq "" } {
            set contract_id [db_string get_id_by_name {
                select contract_id
                from acs_sc_contracts
                where contract_name = :name
            }]
        }

        if { !$no_cascade_p } {

            db_foreach select_operations {
                select operation_id
                from   acs_sc_operations
                where  contract_id = :contract_id
            } {
                acs_sc::contract::operation::delete -operation_id $operation_id
            }

        }

        db_dml delete_contract {
            delete from acs_sc_contracts
            where contract_id = :contract_id
        }
    }
XQL Not present:
Generic
PostgreSQL XQL file:
packages/acs-service-contract/tcl/contract-procs-postgresql.xql

Oracle XQL file:
packages/acs-service-contract/tcl/contract-procs-oracle.xql

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