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)

Partial Call Graph (max 5 caller/called nodes):
%3 test_acs_sc_impl_new_from_spec acs_sc_impl_new_from_spec (test acs-service-contract) acs_sc::contract::delete acs_sc::contract::delete test_acs_sc_impl_new_from_spec->acs_sc::contract::delete acs_sc::contract::operation::delete acs_sc::contract::operation::delete (public) acs_sc::contract::delete->acs_sc::contract::operation::delete db_dml db_dml (public) acs_sc::contract::delete->db_dml db_foreach db_foreach (public) acs_sc::contract::delete->db_foreach db_string db_string (public) acs_sc::contract::delete->db_string db_transaction db_transaction (public) acs_sc::contract::delete->db_transaction auth::authentication::delete_contract auth::authentication::delete_contract (private) auth::authentication::delete_contract->acs_sc::contract::delete auth::get_doc::delete_contract auth::get_doc::delete_contract (private) auth::get_doc::delete_contract->acs_sc::contract::delete auth::password::delete_contract auth::password::delete_contract (private) auth::password::delete_contract->acs_sc::contract::delete auth::process_doc::delete_contract auth::process_doc::delete_contract (private) auth::process_doc::delete_contract->acs_sc::contract::delete auth::registration::delete_contract auth::registration::delete_contract (private) auth::registration::delete_contract->acs_sc::contract::delete

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: