dp_process {-db "" -db_op "update_or_insert" -form_index "" -where_clause ""}What it does:
Does database updates/inserts of all the fields passed from the previous form that start with dp$form_index.Defined in: /web/philip/tcl/data-pipeline-defs.tcl
Source code:
arg_parser_for_dp_process $args set release_db 0 if { [empty_string_p $db] } { set release_db 1 set db [ns_db gethandle subquery] } dp_read_form_variables # Like set_the_usual_for_variables, will return an error # if there is no input unless called with an argument of 0. # # Reads the form data in an ns_set called dp_form dp_read_checkboxes "_cv" "f" # Fills in unchecked boxes to update the data in the tables set error_list [dp_check_var_input $form_index] set num_errors [lindex $error_list 0] # iterates through all form variables and checks if the # value matches the datatype (which is determined by looking # at the fourth part of the variable name) if { $num_errors > 0 } { ad_return_complaint $num_errors [lindex $error_list 1] ad_script_abort } # ns_log Notice "\n\nform_index $form_index" set dp_sql_structs [dp_build_sql_structs $form_index] # create an ns_set where the key is the name of the table # and the value is a dp_sql_struct # Used to store results for each table set ora_results [ns_set create] # At this point, see what tables you have information for, # add any other variables that need to go into the table, # and do the updates if {![empty_string_p $dp_sql_structs]} { set size [ns_set size $dp_sql_structs] for { set i 0 } { $i < $size } { incr i } { set table_name [ns_set key $dp_sql_structs $i] set sql_struct [ns_set value $dp_sql_structs $i] set result [dp_sql_struct_execute $db $sql_struct $table_name $db_op $where_clause] ns_set put $ora_results $table_name $result } } if { $release_db } { ns_db releasehandle $db } return $ora_results