xo::db::CrClass proc get_object_type (public)

 xo::db::CrClass[i] get_object_type [ -item_id item_id ] \
    [ -revision_id revision_id ]

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

Return the object type for an item_id or revision_id.

Switches:
-item_id
(optional)
-revision_id
(defaults to "0") (optional)
Returns:
object_type typically an XOTcl class

Partial Call Graph (max 5 caller/called nodes):
%3 test_test_cr_items test_cr_items (test xotcl-core) xo::db::CrClass proc get_object_type xo::db::CrClass proc get_object_type test_test_cr_items->xo::db::CrClass proc get_object_type test_test_xo_db_object test_xo_db_object (test xotcl-core) test_test_xo_db_object->xo::db::CrClass proc get_object_type

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
[ hide source ] | [ make this the default ]
Show another procedure: