xo::db::CrClass proc id_belongs_to_package (public)

 xo::db::CrClass[i] id_belongs_to_package [ -item_id item_id ] \
    [ -revision_id revision_id ] -package_id package_id 

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

Check if the provided item_id or revision_id belongs to the provided package.

Switches:
-item_id (optional, integer, defaults to "0")
-revision_id (optional, integer, defaults to "0")
-package_id (required, integer)
Returns:
boolean success

Testcases:
create_form_with_form_instance, check_page_template_constraint
Source code:
set id [expr {$revision_id ? $revision_id : $item_id}]
if {$id eq 0} {
  return 0
}
set what [expr {$item_id != 0 ? "item_id" : "revision_id"}]
return [::xo::dc 0or1row -prepare integer,integer check_package [subst {
  select 1 from cr_items, acs_objects
  where $what = :$what and object_id = :$what
  and package_id = :package_id
  fetch first 1 rows only
}]]
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: