xo::db::Class instproc new_persistent_object (public)

 <instance of xo::db::Class[i]> new_persistent_object \
    [ -package_id package_id ] [ -creation_user creation_user ] \
    [ -creation_ip creation_ip ] args [ args... ]

Defined in packages/xotcl-core/tcl/05-db-procs.tcl

Create a new instance of the given class, configure it with the given arguments and insert it into the database. The XOTcl object is destroyed automatically on cleanup (end of a connection request).

Switches:
-package_id
(optional)
-creation_user
(optional)
-creation_ip
(optional)
Parameters:
args
Returns:
fully qualified object

Partial Call Graph (max 5 caller/called nodes):
%3 test_xotcl_core_tutorial_1 xotcl_core_tutorial_1 (test xotcl-core) xo::db::Class instproc new_persistent_object xo::db::Class instproc new_persistent_object test_xotcl_core_tutorial_1->xo::db::Class instproc new_persistent_object test_xotcl_core_tutorial_2 xotcl_core_tutorial_2 (test xotcl-core) test_xotcl_core_tutorial_2->xo::db::Class instproc new_persistent_object ad_log ad_log (public) xo::db::Class instproc new_persistent_object->ad_log ad_try ad_try (public) xo::db::Class instproc new_persistent_object->ad_try

Testcases:
xotcl_core_tutorial_1, xotcl_core_tutorial_2
Source code:
:get_context package_id creation_user creation_ip
::xo::dc transaction {
  set id [:new_acs_object  -package_id $package_id  -creation_user $creation_user  -creation_ip $creation_ip  ""]
  #[self class] set during_fetch 1
  ad_try {
    :create ::$id {*}$args
  } on error {errorMsg} {
    ad_log error "create fails: $errorMsg"
  }
  #[self class] unset during_fetch
  :initialize_acs_object ::$id $id
  ::$id insert
}
::$id destroy_on_cleanup
return ::$id
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: