@Override public void Cmd_run() { Init_bldr_bmks(); this.time_bgn = System_.Ticks(); int total_pending = Xob_xfer_regy_tbl.Select_total_pending(bldr_conn); // if (total_pending > 250000 && src_bin_mgr__fsdb_version == null) usr_dlg.Note_many("", "", "total pending: ~{0}", total_pending); List_adp list = List_adp_.New(); boolean loop = true; while (loop) { byte rslt = Select_fsdb_itms(list); switch (rslt) { case Select_rv_stop: if (bin_db_mgr.Tier_id_is_last(tier_id_val)) loop = false; else { ++tier_id_val; page_id_val = 0; continue; } break; case Select_rv_next_page: ++page_id_val; lnki_id_val = 0; continue; case Select_rv_process: break; } if (!loop) break; // no more ttls found int len = list.Count(); usr_dlg.Prog_many("", "", "fetched pages: ~{0}", len); for (int i = 0; i < len; ++i) { Xodb_tbl_oimg_xfer_itm fsdb = (Xodb_tbl_oimg_xfer_itm) list.Get_at(i); Download_itm(fsdb); if (exit_now || exec_count >= exec_count_max || exec_fail >= exec_fail_max || page_id_val >= page_id_end) { this.Txn_sav(); return; } } } exec_done = true; }
private byte Select_fsdb_itms(List_adp list) { list.Clear(); boolean pages_found = false, links_found = false; DataRdr rdr = Xob_xfer_regy_tbl.Select_by_tier_page(bldr_conn, tier_id_val, page_id_val, select_interval); try { while (rdr.MoveNextPeer()) { pages_found = true; // at least one page found; set true Xodb_tbl_oimg_xfer_itm itm = Xodb_tbl_oimg_xfer_itm.new_rdr_(rdr); if (itm.Lnki_page_id() == page_id_val // same page_id && itm.Lnki_id() <= lnki_id_val // ... but lnki_id < last ) continue; // ... ignore; note that select is by page_id, not page_id + link_id; needed // else restarts would not resume exactly at same point; links_found = true; list.Add(itm); } } finally { rdr.Rls(); } if (pages_found && !links_found) return Select_rv_next_page; // pages found, but all links processed else if (!pages_found) return Select_rv_stop; // no more pages found else return Select_rv_process; // pages and links found }