xo::db::CrItem instproc update_attribute_from_slot (public)
<instance of xo::db::CrItem> update_attribute_from_slot \ [ -revision_id revision_id ] slot value
Defined in /var/www/openacs/packages/xotcl-core/tcl/cr-procs.tcl
Update the in-memory attribute and persist the value in the slot's column for the specified revision.
- Switches:
- -revision_id (optional)
- Revision to update, defaulting to this item's revision.
- Parameters:
- slot (required, object)
- Attribute slot describing the target table and column.
- value (required)
- Attribute value to store.
- Testcases:
- slot_interactions
Source code: set :[$slot name] $value if {![info exists revision_id]} { set revision_id ${:revision_id} } set domain [$slot domain] #set sql "update [$domain table_name] # set [$slot column_name] = '$value' # where [$domain id_column] = $revision_id" #ns_log notice UPDATE-$sql ::xo::dc dml update_attribute_from_slot [subst { update [$domain table_name] set [$slot column_name] = :value where [$domain id_column] = :revision_id }] # # Probably we should call here update_last_modified, but for # that we would need the modifying_user and the modifying IP # address. # # ::acs::dc call acs_object update_last_modified # -object_id $revision_id # -modifying_user ${:publish_status} # -modifying_ip ... ::xo::dc dml update_attribute_from_slot_last_modified { update acs_objects set last_modified = CURRENT_TIMESTAMP where object_id = :revision_id }XQL Not present: Generic, PostgreSQL, Oracle
![[i]](/resources/acs-subsite/ZoomIn16.gif)