one of the documented procedures in this installation of the ACS
wap_db_user_agent_p   agent
What it does:
Returns 1 if agent matches a list of known WAP user agents.
Defined in: /web/philip/tcl/wap-defs.tcl

Source code:

    set compare_length [ad_parameter WapUAStringCompareLength wap 4]

    set db [ns_db gethandle subquery]

    ns_log Notice "wap_db_user_agent_p: hitting the db to check $agent"

    set retval [database_to_tcl_string $db "select count(*)
    from wap_user_agents
    where lower(substr('[DoubleApos $agent]',1,$compare_length)) like
          lower(substr(name,1,$compare_length)) || '%'
      and deletion_date is null"]

    ns_db releasehandle $db

    if { $retval > 0} {
	return 1
    } else {
	return 0