示例#1
0
 public void Cmd_bgn(Xob_bldr bldr) {
   Db_conn conn = Xob_db_file.new__file_make(wiki.Fsys_mgr().Root_dir()).Conn();
   Xob_xfer_temp_tbl.Create_table(conn);
   Db_stmt trg_stmt = Xob_xfer_temp_tbl.Insert_stmt(conn);
   conn.Txn_bgn();
   DataRdr rdr = conn.Exec_sql_as_rdr(Sql_select);
   Xob_xfer_temp_itm temp_itm = new Xob_xfer_temp_itm();
   Xof_img_size img_size = new Xof_img_size();
   byte[] cur_ttl = Bry_.Empty;
   byte cur_repo = Byte_.Max_value_127;
   while (rdr.MoveNextPeer()) {
     temp_itm.Clear();
     temp_itm.Load(rdr);
     if (Bry_.Eq(cur_ttl, temp_itm.Orig_file_ttl())) { // same ttl; DATE:2015-03-22
       if (temp_itm.Orig_repo()
           != cur_repo) // if repo is different, ignore 2nd; handles images in both repos; take 1st
         // only (which should be local)
         continue;
     } else { // new ttl; update ttl, repo
       cur_ttl = temp_itm.Orig_file_ttl();
       cur_repo = temp_itm.Orig_repo();
     }
     if (temp_itm.Chk(img_size)) temp_itm.Insert(trg_stmt, img_size);
   }
   conn.Txn_end();
 }
 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
 }
 public static Xodb_tbl_oimg_xfer_itm new_rdr_(DataRdr rdr) {
   Xodb_tbl_oimg_xfer_itm rv = new Xodb_tbl_oimg_xfer_itm();
   rv.lnki_id = rdr.ReadInt(Xob_xfer_regy_tbl.Fld_lnki_id);
   rv.lnki_page_id = rdr.ReadInt(Xob_xfer_regy_tbl.Fld_lnki_page_id);
   rv.lnki_tier_id = rdr.ReadInt(Xob_xfer_regy_tbl.Fld_lnki_tier_id);
   rv.Init_at_fsdb_make(
       rdr.ReadBryByStr(Xob_xfer_regy_tbl.Fld_lnki_ttl),
       rdr.ReadInt(Xob_xfer_regy_tbl.Fld_lnki_ext),
       rdr.ReadInt(Xob_xfer_regy_tbl.Fld_file_w),
       rdr.ReadInt(Xob_xfer_regy_tbl.Fld_file_h) // set lnki_size; Xof_bin_mgr uses lnki_size
       ,
       Xof_lnki_time.Db_load_double(rdr, Xob_xfer_regy_tbl.Fld_lnki_time),
       Xof_lnki_page.Db_load_int(rdr, Xob_xfer_regy_tbl.Fld_lnki_page),
       rdr.ReadByte(Xob_xfer_regy_tbl.Fld_orig_repo),
       rdr.ReadInt(Xob_xfer_regy_tbl.Fld_orig_w),
       rdr.ReadInt(Xob_xfer_regy_tbl.Fld_orig_h),
       Bry_.Empty,
       rdr.ReadByte(Xob_xfer_regy_tbl.Fld_file_is_orig) == Bool_.Y_byte);
   return rv;
 }