irc::logger::rotate_logs (public)
irc::logger::rotate_logs -package_id package_id [ -all ]
Defined in packages/irc-logger/tcl/irc-logger-procs.tcl
Rotate the ETP pages so that the ETP page with the new log is listed first instead of last. Please be aware that changes to the sort order through of these logs through ETP might have undesired side effects to the order. This an artifact of ETP and not of the IRC logger.
- Switches:
- -package_id (required)
- The package_id of the ETP instance that is the parent of the ETP log pages.
- -all (optional, boolean)
- Returns:
- none
- Error:
- none
- Author:
- Bart Teeuwisse <bart.teeuwisse@thecodemill.biz>
- Created:
- 2003-02-18
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: # Get the ID of the parent folder of the ETP log pages. set parent_id [db_string get_parent_id {} -default {}] # Rotate all ETP pages or just the logs? if {$all_p} { set i1_select_criteria "true" set i2_select_criteria "true" } else { set i1_select_criteria [db_map i1_criteria] set i2_select_criteria [db_map i2_criteria] } # Rotate the logs by assigning the tree_sortkey of the next ETP # page to the current page. Assign the tree_sortkey of the first # page to the last (=new) page. db_foreach etp_logs {} { # Assign the tree_sortkey of the next ETP page to the current # page or the tree_sortkey of the first ETP to the last page. db_dml shift {} }XQL Not present: Oracle Generic XQL file: <fullquery name="irc::logger::rotate_logs.i1_criteria"> <querytext> (i1.content_type <> 'content_extlink' or i1.content_type is null) </querytext> </fullquery> <fullquery name="irc::logger::rotate_logs.i2_criteria"> <querytext> (i2.content_type <> 'content_extlink' or i2.content_type is null) </querytext> </fullquery> <fullquery name="irc::logger::rotate_logs.shift"> <querytext> update cr_items set tree_sortkey = :next_sortkey where item_id = :item_id </querytext> </fullquery>packages/irc-logger/tcl/irc-logger-procs.xql
PostgreSQL XQL file: <fullquery name="irc::logger::rotate_logs.get_parent_id"> <querytext> select etp__get_folder_id(:package_id) </querytext> </fullquery> <fullquery name="irc::logger::rotate_logs.etp_logs"> <querytext> select i1.item_id, i1.tree_sortkey, coalesce(( select tree_sortkey from cr_items i2 where i2.tree_sortkey > i1.tree_sortkey and i2.parent_id = :parent_id and i2.name <> 'index' and $i2_select_criteria order by i2.tree_sortkey limit 1), ( select i2.tree_sortkey from cr_items i2 where i2.parent_id = :parent_id and i2.name <> 'index' and $i2_select_criteria order by i2.tree_sortkey limit 1)) as next_sortkey from cr_items i1 where i1.parent_id = :parent_id and i1.name <> 'index' and $i1_select_criteria order by i1.tree_sortkey; </querytext> </fullquery>packages/irc-logger/tcl/irc-logger-procs-postgresql.xql