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

 xo::db::CrClass[i] get_instance_from_db [ -item_id item_id ] \
    [ -revision_id revision_id ] [ -initialize on|off ]

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

Instantiate the live revision or the specified revision of an CrItem. The XOTcl object is destroyed automatically on cleanup (end of a connection request).

Switches:
-item_id
(defaults to "0") (optional)
-revision_id
(defaults to "0") (optional)
-initialize
(boolean) (defaults to "true") (optional)
Returns:
fully qualified object containing the attributes of the CrItem

Partial Call Graph (max 5 caller/called nodes):
%3 test_create_workflow_with_instance create_workflow_with_instance (test xowf) xo::db::CrClass proc get_instance_from_db xo::db::CrClass proc get_instance_from_db test_create_workflow_with_instance->xo::db::CrClass proc get_instance_from_db test_link_tests link_tests (test xowiki) test_link_tests->xo::db::CrClass proc get_instance_from_db test_path_resolve path_resolve (test xowiki) test_path_resolve->xo::db::CrClass proc get_instance_from_db test_slot_interactions slot_interactions (test xowiki) test_slot_interactions->xo::db::CrClass proc get_instance_from_db test_test_cr_items test_cr_items (test xotcl-core) test_test_cr_items->xo::db::CrClass proc get_instance_from_db ad_log ad_log (public) xo::db::CrClass proc get_instance_from_db->ad_log nsf::is nsf::is xo::db::CrClass proc get_instance_from_db->nsf::is

Testcases:
test_cr_items, create_workflow_with_instance, xowiki_test_cases, link_tests, slot_interactions, path_resolve
Source code:
set object ::[expr {$revision_id ? $revision_id : $item_id}]
if {$object eq "::0"} {
  set msg "get_instance_from_db must be called with either item_id or revision_id different from 0"
  ad_log error $msg
  error $msg
}
if {![::nsf::is object $object]} {
  set object_type [:get_object_type -item_id $item_id -revision_id $revision_id]
  set class [::xo::db::Class object_type_to_class $object_type]
  set object [$class get_instance_from_db -item_id $item_id -revision_id $revision_id -initialize $initialize]
}
return $object
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: