dp_add_one_col_to_sql_struct

one of the documented procedures in this installation of the ACS
Usage:
dp_add_one_col_to_sql_struct   sql_struct   col_name   col_value   { data_type "text" }
What it does:
Returns a little sql bit useful for update (e.g., last_name='O''Grady'), where the value is escaped based on the data type.
Defined in: /web/philip/tcl/data-pipeline-defs.tcl

Source code:



    dp_sql_struct_add_col_name $sql_struct $col_name

    switch -exact $data_type {
        year { 
	    dp_sql_struct_add_col_val $sql_struct "to_date('$col_value','YYYY')" 
	}
        money { 
            if [empty_string_p $col_value] {
                dp_sql_struct_add_col_val $sql_struct "null"
            } else {
		# take out any commas
		regsub -all {,} $col_value {} col_value
                dp_sql_struct_add_col_val $sql_struct "$col_value" 
	    }}
        int {
            if [empty_string_p $col_value] {
                dp_sql_struct_add_col_val $sql_struct "null"
            } else {
                dp_sql_struct_add_col_val $sql_struct "$col_value"
            }}
        expr {
            if [empty_string_p $col_value] {
                dp_sql_struct_add_col_val $sql_struct "null"
            } else {
                dp_sql_struct_add_col_val $sql_struct "$col_value"
            }}
	clob {
	    if {[empty_string_p $col_value]} {
		dp_sql_struct_add_col_val $sql_struct "null"
	    } elseif {[string length $col_value]<4000} {
		dp_sql_struct_add_col_val $sql_struct "'[DoubleApos $col_value]'"
	    } else {
		dp_sql_struct_add_col_val $sql_struct "empty_clob()"
		dp_sql_struct_set_tcl_proc $sql_struct "ns_ora clob_dml"
		dp_sql_struct_add_returning_col $sql_struct $col_name
		dp_sql_struct_add_tcl_extra_arg $sql_struct \{$col_value\}
	    }
	    
	}
	default { 
	    dp_sql_struct_add_col_val $sql_struct "'[DoubleApos $col_value]'" 
	}
     
    }


philg@mit.edu