Index: openacs-4/packages/acs-service-contract/tcl/contract-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-service-contract/tcl/contract-procs-oracle.xql,v diff -u -r1.3 -r1.3.26.1 --- openacs-4/packages/acs-service-contract/tcl/contract-procs-oracle.xql 30 Sep 2003 12:10:03 -0000 1.3 +++ openacs-4/packages/acs-service-contract/tcl/contract-procs-oracle.xql 2 Jan 2020 18:04:58 -0000 1.3.26.1 @@ -13,43 +13,7 @@ end; - - - - acs_sc_contract.get_name( - :contract_id - ) from dual - - - - - - select acs_sc_contract.get_id( - :name - ) from dual - - - - - - select operation_id, - operation_inputtype_id, - operation_outputtype_id - from acs_sc_operations - where contract_id = :contract_id - - - - - - begin - acs_sc_contract.del( - contract_name => :name - ); - end; - - - + begin @@ -66,25 +30,5 @@ - - - select contract_name, - operation_name - from acs_sc_operations - where operation_id = :operation_id - - - - - - begin - acs_sc_operation.del( - contract_name => :contract_name, - operation_name => :operation_name - ); - end; - - - Index: openacs-4/packages/acs-service-contract/tcl/contract-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-service-contract/tcl/contract-procs-postgresql.xql,v diff -u -r1.1 -r1.1.28.1 --- openacs-4/packages/acs-service-contract/tcl/contract-procs-postgresql.xql 3 Feb 2003 12:17:36 -0000 1.1 +++ openacs-4/packages/acs-service-contract/tcl/contract-procs-postgresql.xql 2 Jan 2020 18:04:58 -0000 1.1.28.1 @@ -11,35 +11,7 @@ ); - - - - select acs_sc_contract__get_name(:contract_id); - - - - - - select acs_sc_contract__get_id(:name); - - - - - - select operation_id, - operation_inputtype_id, - operation_outputtype_id - from acs_sc_operations - where contract_id = :contract_id - - - - - - select acs_sc_contract__delete(:name); - - - + select acs_sc_operation__new( @@ -54,20 +26,5 @@ - - - select contract_name, - operation_name - from acs_sc_operations - where operation_id = :operation_id - - - - - - select acs_sc_operation__delete(:contract_name, :operation_name); - - - Index: openacs-4/packages/acs-service-contract/tcl/contract-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-service-contract/tcl/contract-procs.tcl,v diff -u -r1.13 -r1.13.2.1 --- openacs-4/packages/acs-service-contract/tcl/contract-procs.tcl 17 Jun 2018 19:20:09 -0000 1.13 +++ openacs-4/packages/acs-service-contract/tcl/contract-procs.tcl 2 Jan 2020 18:04:58 -0000 1.13.2.1 @@ -150,17 +150,31 @@ db_transaction { # Need both name and ID below if { $name eq "" } { - set name [db_string get_name_by_id {}] + 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 {}] + set contract_id [db_string get_id_by_name { + select contract_id + from acs_sc_contracts + where contract_name = :contract_name + }] } if { !$no_cascade_p } { set operations [list] set msg_types [list] - db_foreach select_operations {} { + db_foreach select_operations { + select operation_id, + operation_inputtype_id, + operation_outputtype_id + from acs_sc_operations + where contract_id = :contract_id + } { # Put them on list of message types and operations to delete lappend msg_types $operation_inputtype_id lappend msg_types $operation_outputtype_id @@ -180,10 +194,10 @@ } } - # LARS: - # It seems like delete by ID doesn't work, because our PG bind thing turns all integers into strings - # by wrapping them in single quotes, causing PG to invoke the function for deleting by name - db_exec_plsql delete_by_name {} + db_dml delete_contract { + delete from acs_sc_contracts + where contract_id = :contract_id + } } } @@ -192,7 +206,13 @@ } { Get a list of names of operations for the contract. } { - return [db_list select_operations {}] + return [db_list select_operations { + select o.operation_name + from acs_sc_operations o, + acs_sc_contracts c + where c.contract_name = :contract_name + and o.contract_id = c.contract_id + }] } @@ -254,16 +274,19 @@ error "You must supply either contract_name and operation_name, or operation_id" } - # LARS: - # It seems like delete by ID doesn't work, because our PG bind thing turns all integers into strings - # by wrapping them in single quotes, causing PG to invoke the function for deleting by name - - if { $contract_name eq "" || $operation_name eq "" } { - # get contract_name and operation_name - db_1row select_names {} + if {$operation_id eq ""} { + set operation_id [db_string get_id { + select operation_id + from acs_sc_operations + where contract_name = :contract_name + and operation_name = :operation_name + }] } - db_exec_plsql delete_by_name {} + db_dml delete_operation { + delete from acs_sc_operations + where operation_id = :operation_id + } } ad_proc -public acs_sc::contract::operation::parse_operations_spec {