xowiki::hstore::update_form_instance_item_index (private)

 xowiki::hstore::update_form_instance_item_index \
    [ -package_id package_id ] [ -object_class object_class ] \
    [ -initialize initialize ]

Defined in packages/xowiki/tcl/xowiki-utility-procs.tcl

update all instance attributes in hstore

Switches:
-package_id
(optional)
-object_class
(defaults to "::xowiki::FormPage") (optional)
-initialize
(defaults to "false") (optional)

Partial Call Graph (max 5 caller/called nodes):
%3 xowiki::hstore::dict_as_hkey xowiki::hstore::dict_as_hkey (public) xowiki::hstore::update_form_instance_item_index xowiki::hstore::update_form_instance_item_index xowiki::hstore::update_form_instance_item_index->xowiki::hstore::dict_as_hkey

Testcases:
No testcase defined.
Source code:
    #
    # This proc can be used from ds/shell as follows
    #
    #    ::xowiki::hstore::update_form_instance_item_index -package_id $package_id
    #
    # Check the packages which do not have the hkey set:
    #
    #    select hkey from xowiki_form_instance_item_index where hkey is null;
    #
    set t0 [clock clicks -milliseconds]
    ns_log notice "start to work on -package_id $package_id"

    ::xo::Package require $package_id

    set t1 [clock clicks -milliseconds]
    ns_log notice "$package_id: ::xo::Package require took [expr {$t1-$t0}]ms"
    set t0 $t1

    if {![::xo::dc has_hstore] && [::$package_id get_parameter use_hstore:boolean 0] } {
      return 0
    }

    set sql {
      select * from xowiki_form_instance_item_view
      where package_id = :package_id
    }
    set items [::xowiki::FormPage instantiate_objects -sql $sql  -object_class $object_class -initialize $initialize]

    set t1 [clock clicks -milliseconds]
    ns_log notice "$package_id: obtaining [llength [$items children]] items took [expr {$t1-$t0}]ms"
    set t0 $t1

    set count 0
    foreach p [$items children] {

      set hkey [::xowiki::hstore::dict_as_hkey [$p hstore_attributes]]
      set item_id [$p item_id]

      set t0 [clock clicks -milliseconds]

      xo::dc dml update_hstore "update xowiki_form_instance_item_index  set hkey = '$hkey'  where item_id = :item_id"

      set t1 [clock clicks -milliseconds]
      ns_log notice "$package_id $count: update took [expr {$t1-$t0}]ms"
      set t0 $t1

      incr count
    }

    $items log "updated $count objects from package $package_id"
    return $count
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: