xo::db::CrClass proc get_object_type (public)
xo::db::CrClass get_object_type -item_id item_id \ [ -revision_id revision_id ]
Defined in /var/www/openacs.org/packages/xotcl-core/tcl/cr-procs.tcl
Return the object type for an item_id or revision_id.
- Switches:
- -item_id (required, integer)
- -revision_id (optional, integer, defaults to
"0"
)- Returns:
- object_type typically an XOTcl class
- Testcases:
- test_xo_db_object, test_cr_items
Source code: # # Use a request-spanning cache. When the object_type would change, # we require xo::broadcast or server restart. # set key ::xo::object_type($item_id,$revision_id) if {[info exists $key]} { return [set $key] } set entry_key [expr {$item_id ? $item_id : $revision_id}] set $key [xo::xotcl_object_type_cache eval -partition_key $entry_key $entry_key { if {$item_id} { ::xo::dc 1row -prepare integer get_class_from_item_id "select content_type as object_type from cr_items where item_id=:item_id" } else { ::xo::dc 1row -prepare integer get_class_from_revision_id "select object_type from acs_objects where object_id=:revision_id" } return $object_type }]XQL Not present: Generic, PostgreSQL, Oracle