xo::db::Class proc get_instance_from_db (public)
xo::db::Class get_instance_from_db -id id
Defined in /var/www/openacs.org/packages/xotcl-core/tcl/05-db-procs.tcl
Create an XOTcl object from an acs_object_id. This method determines the type and initializes the object from the information stored in the database. The XOTcl object is destroyed automatically on cleanup (end of a connection request).
- Switches:
- -id (required, integer)
- Returns:
- fully qualified object
- Testcases:
- xotcl_core_tutorial_1, xotcl_core_tutorial_2, test_xo_db_object
Source code: set type [:get_object_type -id $id] set class [::xo::db::Class object_type_to_class $type] if {![:isclass $class]} { error "no class $class defined" } set r [$class create ::$id] $r db_1row dbqd..get_instance [$class fetch_query $id] $r set object_id $id $r destroy_on_cleanup $r initialize_loaded_object return $rXQL Not present: Generic, PostgreSQL, Oracle