xowiki::FormPage proc fetch_object (public)
xowiki::FormPage fetch_object -item_id item_id \ [ -revision_id revision_id ] -object object \ [ -initialize on|off ]
Defined in /var/www/openacs.org/packages/xowiki/tcl/xowiki-procs.tcl
Load a content item into the specified object. If revision_id is provided, the specified revision is returned, otherwise the live revision of the item_id. If the object does not exist, we create it.
- Switches:
- -item_id (required)
- -revision_id (optional, defaults to
"0"
)- -object (required)
- -initialize (optional, boolean, defaults to
"true"
)- Returns:
- cr item object
- Testcases:
- xowiki_test_cases, link_tests, path_resolve
Source code: #ns_log notice "=== fetch_object $item_id" # # We handle here just loading object instances via item_id, since # only live_revisions are kept in xowiki_form_instance_item_index. # The loading via revision_id happens as before in CrClass. # if {$item_id == 0} { return [next] } if {![nsf::is object $object]} { # if the object does not yet exist, we have to create it :create $object } db_with_handle db { set sql [::xo::dc prepare -handle $db -argtypes integer { select * from xowiki_form_instance_item_view where item_id = :item_id }] set selection [db_exec 0or1row $db dbqd..Formpage-fetch_object $sql] } if {$selection eq ""} { error [subst { The form page with item_id $item_id was not found in the xowiki_form_instance_item_index. Consider 'DROP TABLE xowiki_form_instance_item_index CASCADE;' and restart server (the table is rebuilt automatically, but this could take a while, when the number of pages is huge). }] } $object mset [ns_set array $selection] if {$initialize} { $object initialize_loaded_object } return $objectXQL Not present: Generic, PostgreSQL, Oracle