ticket_query

one of the documented procedures in this installation of the ACS
Usage:
ticket_query   form   key   field   like_p   case_insensitive_p
What it does:
build a subclause
Defined in: /web/philip/tcl/ticket-defs.tcl

Source code:

 
    set join(and) and
    set join(and_not) {and not}
    set join(or) or

    set i 0
    set out {}
    set idx [ns_set find $form ${key}_$i]

    while { $idx > -1} {
        set compare [ns_set value $form $idx]
        
        if {![empty_string_p $compare]} {
            if {$case_insensitive_p} { 
                append out " lower($field) "
                if {$like_p} { 
                    append out "like '%[DoubleApos [string tolower $compare]]%' "
                } else { 
                    append out "= '[DoubleApos [string tolower $compare]]') "
                }
            } else { 
                append out " $field "
                if {$like_p} { 
                    append out "like '%[DoubleApos $compare]%' "
                } else { 
                    append out "= '[DoubleApos $compare]' "
                }
            } 
            set jidx [ns_set find $form ${key}_j_$i]
            incr i
            set idx [ns_set find $form ${key}_$i]
            if {$jidx > 0 && 
                ![empty_string_p [ns_set value $form $idx]]} {
                append out $join([ns_set value $form $jidx])
            }
        } else { 
            incr i
            set idx [ns_set find $form ${key}_$i]
        }
    }
    return $out


philg@mit.edu