xo::ConnectionContext instproc query_parameter (public)

 <instance of xo::ConnectionContext[i]> query_parameter __spec \
    [ default ]

Defined in packages/xotcl-core/tcl/context-procs.tcl

Get query parameter with default and optional value constraints. In case the value check for the query parameter fails, and no further precautions are performed (::aa_test_noabort is set), the method raises an exception with "ad_return_complaint" and aborts the script.

Parameters:
__spec - has the formname or name:value_constraint
default (optional) - default value
Returns:
actual value of the query parameter

Partial Call Graph (max 5 caller/called nodes):
%3 test_api__context api__context (test xotcl-core) xo::ConnectionContext instproc query_parameter xo::ConnectionContext instproc query_parameter test_api__context->xo::ConnectionContext instproc query_parameter test_path_resolve path_resolve (test xowiki) test_path_resolve->xo::ConnectionContext instproc query_parameter test_test_xo_cc test_xo_cc (test xotcl-core) test_test_xo_cc->xo::ConnectionContext instproc query_parameter xo::validate_parameter_constraints xo::validate_parameter_constraints (public) xo::ConnectionContext instproc query_parameter->xo::validate_parameter_constraints

Testcases:
api__context, test_xo_cc, path_resolve
Source code:
#
# Try to split up provided "__spec" argument into name and
# value constraint components.
#
set __name $__spec
regexp {^([^:]+):(.*)$} $__spec . __name constraint

if {[:exists_parameter $__name]} {
  set value [:get_parameter $__name]
} else {
  set value [next $__name $default]
}
#
# If we have a value-constraint, we check for empty values only in
# cases, where multiplicity is specified. This means effectively
# that the default multiplicity is "0..1".
#
if {[info exists constraint]} {
  set r [xo::validate_parameter_constraints $__name $constraint $value]
  if {$r ne $value} {
    ns_log notice "converting value checker: query parameter <$__spec> -> '$value' -> '$r'"
    set value $r
  }
}
return $value
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: