xo::Context instproc process_query_parameter
<instance of xo::Context> process_query_parameter
Defined in
- Testcases:
-
api__context, xotcl-core
Source code:
set declared_parameters [lmap v ${:parameter_declaration} {
string range [lindex [split [lindex $v 0] :] 0] 1 end
}]
if {${:actual_query} eq " "} {
if {[ns_conn isconnected]} {
set :actual_query [ns_conn query]
}
}
set passed_args ""
try {
set paramset [ns_parsequery ${:actual_query}]
foreach {att_name att_value} [ns_set array $paramset] {
if {$att_name eq ""} continue
if {$att_name in $declared_parameters} {
dict lappend passed_args -$att_name $att_value
} elseif {$all_from_query} {
set :queryparm($att_name) $att_value
}
}
} on error {errorMsg} {
ad_log warning "process_query_parameter: $errorMsg"
ad_return_complaint 1 "invalid characters in HTTP query parameters"
}
if {[:istype ::xo::ConnectionContext]} {
foreach name $declared_parameters {
set param -$name
if {![dict exists $passed_args $param]
&& [:exists_form_parameter $name]
} {
dict set passed_args $param [:form_parameter $name]
}
}
}
if {[info exists caller_parameters]} {
foreach param [dict keys $caller_parameters] {
set name [string range $param 1 end]
if {$name in $declared_parameters} {
dict set passed_args $param [dict get $caller_parameters $param]
} elseif {$all_from_caller} {
set :queryparm($name) [dict get $caller_parameters $param]
lappend declared_parameters $name
}
}
}
if {[::acs::icanuse "nsf::parseargs -asdict"]} {
try {
foreach {k v} [nsf::parseargs -asdict ${:parameter_declaration} $passed_args] {
set :queryparm($k) $v
}
} on error {errorMsg} {
ad_return_complaint 1 [ns_quotehtml $errorMsg]
ad_script_abort
}
} else {
:proc __parse ${:parameter_declaration} {
foreach v [info vars] {
:log "--cc uplevel [list set :queryparm($v) [set $v]]"
uplevel [list set :queryparm($v) [set $v]]
}
}
if {[catch {[self] __parse {*}$passed_args} errorMsg]} {
ad_return_complaint 1 [ns_quotehtml $errorMsg]
ad_script_abort
}
}
set :declared_parameters $declared_parameters
XQL Not present:Generic, PostgreSQL, Oracle
[
hide source ]
| [
make this the default ]