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

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

Defined in /var/www/openacs.org/packages/xotcl-core/tcl/cr-procs.tcl

Retrieve either the live revision or a specified revision of a content item with all attributes into a newly created object. The retrieved attributes are stored in the instance variables in class representing the object_type. The XOTcl object is destroyed automatically on cleanup (end of a connection request)

Switches:
-item_id (optional, defaults to "0")
id of the item to be retrieved.
-revision_id (optional, defaults to "0")
revision-id of the item to be retrieved.
-initialize (optional, boolean, defaults to "true")
Returns:
fully qualified object

Testcases:
xotcl_core_tutorial_4, test_cr_items, create_folder_with_page, xowiki_test_cases, create_form_with_form_instance
Source code:
set object ::[expr {$revision_id ? $revision_id : $item_id}]
if {![nsf::is object $object]} {
  :fetch_object -object $object  -item_id $item_id -revision_id $revision_id  -initialize $initialize
  $object destroy_on_cleanup
}
return $object
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: