nsmcp::Object method dict getdef (protected)
<instance of nsmcp::Object> dict getdef dictionary key default
Defined in /usr/local/ns/tcl/nsmcp/00-lifecycle.tcl
Read a dictionary entry with an explicit default for a missing key. Preserve stored empty, false and zero values. Invalid dictionaries raise the normal Tcl error; the default applies only to absence.
- Parameters:
- dictionary (required)
- Dictionary to inspect.
- key (required)
- Entry key.
- default (required)
- Result when the key is absent.
- Returns:
- The stored value, or default when key is absent.
- Testcases:
- No testcase defined.
Source code: if {[dict exists $dictionary $key]} { return [dict get $dictionary $key] } # dict exists also returns false for malformed input. Validate before # accepting absence so a corrupt dictionary is not treated as empty. dict size $dictionary return $defaultXQL Not present: Generic, PostgreSQL, Oracle
![[i]](/resources/acs-subsite/ZoomIn16.gif)