dp_build_sql_structs { form_index " " }What it does:
Upvars to get the $dp_form ns_set, and builds a bunch of dp_sql_structs that will perform the SQL necessary to process all the dp_form variables prefixed by "dp$form_index". The return value is an ns_set where key is table name and value is a dp_sql_struct. Arguments: form_index - The only items in the $dp_form ns_set that get processed are the ones whose keys are of the form "dp_form$form_index.*"Defined in: /web/philip/tcl/data-pipeline-defs.tcl
Source code:
upvar dp_form dp_form
set dp_sql_structs [ns_set new]
foreach var [dp_list_packed_vars $form_index] {
set varname_parts [split $var .]
set table_name [lindex $varname_parts 1]
set col_name [lindex $varname_parts 2]
set datatype [lindex $varname_parts 3]
if {![info exists table_sql_struct.$table_name]} {
set table_sql_struct.$table_name [dp_sql_struct_new]
ns_set put $dp_sql_structs $table_name [set table_sql_struct.$table_name]
set found_some_p 1
}
dp_add_one_col_to_sql_struct [set table_sql_struct.$table_name] $col_name [dp_formvalue $var] $datatype
}
if [info exists found_some_p] {
return $dp_sql_structs
} else {
return
}