mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
Custom_wiki: Refactor code; also show images on file namespace page
This commit is contained in:
parent
ca8017a876
commit
78526c00c6
@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.files; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.xowa.files.fsdb.*;
|
||||
import gplx.xowa.files.fsdb.fs_roots.*;
|
||||
class Xof_wkr_mgr implements Gfo_invk {
|
||||
private Xow_file_mgr file_mgr;
|
||||
public Xof_wkr_mgr(Xow_file_mgr file_mgr) {this.file_mgr = file_mgr;}
|
||||
@ -26,12 +27,10 @@ class Xof_wkr_mgr implements Gfo_invk {
|
||||
}
|
||||
private static final String Invk_get = "get";
|
||||
private Xof_fsdb_mgr Get_or_new(String key) {
|
||||
Xof_fsdb_mgr rv = null;
|
||||
if (String_.Eq(key, "fs.dir"))
|
||||
rv = new gplx.xowa.files.fsdb.fs_roots.Fs_root_fsdb_mgr(file_mgr.Wiki());
|
||||
if (String_.Eq(key, "fs.dir")) {
|
||||
return Fs_root_core.New(file_mgr, file_mgr.Wiki());
|
||||
}
|
||||
else
|
||||
throw Err_.new_unhandled(key);
|
||||
file_mgr.Fsdb_mgr_(rv);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
@ -16,12 +16,10 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.files.fsdb; import gplx.*; import gplx.xowa.*; import gplx.xowa.files.*;
|
||||
import gplx.fsdb.*; import gplx.fsdb.data.*; import gplx.fsdb.meta.*;
|
||||
import gplx.xowa.files.bins.*; import gplx.xowa.files.origs.*; import gplx.xowa.files.caches.*; import gplx.xowa.guis.cbks.js.*;
|
||||
public interface Xof_fsdb_mgr {
|
||||
Xof_bin_mgr Bin_mgr();
|
||||
Fsm_mnt_mgr Mnt_mgr();
|
||||
void Init_by_wiki(Xow_wiki wiki);
|
||||
void Fsdb_search_by_list(List_adp itms, Xow_wiki wiki, Xoa_page page, Xog_js_wkr js_wkr);
|
||||
void Rls();
|
||||
gplx.xowa.files.bins.Xof_bin_mgr Bin_mgr();
|
||||
gplx.fsdb.meta.Fsm_mnt_mgr Mnt_mgr();
|
||||
void Init_by_wiki(Xow_wiki wiki);
|
||||
void Fsdb_search_by_list(List_adp itms, Xow_wiki wiki, Xoa_page page, gplx.xowa.guis.cbks.js.Xog_js_wkr js_wkr);
|
||||
void Rls();
|
||||
}
|
||||
|
69
400_xowa/src/gplx/xowa/files/fsdb/fs_roots/Fs_root_core.java
Normal file
69
400_xowa/src/gplx/xowa/files/fsdb/fs_roots/Fs_root_core.java
Normal file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.files.fsdb.fs_roots; import gplx.*; import gplx.xowa.*; import gplx.xowa.files.*; import gplx.xowa.files.fsdb.*;
|
||||
import gplx.xowa.guis.cbks.js.*;
|
||||
public class Fs_root_core implements Xof_fsdb_mgr, Gfo_invk { // reads images from file-system dir
|
||||
private Xowe_wiki wiki;
|
||||
private final Fs_root_mgr mgr;
|
||||
public Fs_root_core(Xowe_wiki wiki) {
|
||||
this.Init_by_wiki(wiki);
|
||||
this.mgr = new Fs_root_mgr(wiki);
|
||||
}
|
||||
public gplx.xowa.files.bins.Xof_bin_mgr Bin_mgr() {throw Err_.new_unimplemented();}
|
||||
public gplx.fsdb.meta.Fsm_mnt_mgr Mnt_mgr() {return null;}
|
||||
public void Init_by_wiki(Xow_wiki wiki) {
|
||||
this.wiki = (Xowe_wiki)wiki;
|
||||
}
|
||||
public void Fsdb_search_by_list(List_adp itms, Xow_wiki wiki, Xoa_page page, Xog_js_wkr js_wkr) {
|
||||
int itms_len = itms.Count();
|
||||
|
||||
// NOTE: do not cache in /xowa/file b/c files will already exist in /xowa/wiki/wiki_name/file/thumb
|
||||
gplx.xowa.files.caches.Xou_cache_mgr cache_mgr = wiki.App().User().User_db_mgr().Cache_mgr();
|
||||
for (int i = 0; i < itms_len; i++) {
|
||||
Xof_fsdb_itm itm = (Xof_fsdb_itm)itms.Get_at(i);
|
||||
if (mgr.Find_file(itm)) {
|
||||
Js_img_mgr.Update_img(page, js_wkr, itm);
|
||||
cache_mgr.Update(itm);
|
||||
}
|
||||
}
|
||||
cache_mgr.Db_save();
|
||||
}
|
||||
public void Rls() {}
|
||||
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_root_dir_)) mgr.Root_dir_(To_url(m.ReadBry("v")));
|
||||
else if (ctx.Match(k, Invk_orig_dir_)) mgr.Orig_dir_(To_url(m.ReadBry("v")));
|
||||
else if (ctx.Match(k, Invk_thumb_dir_)) mgr.Thumb_dir_(To_url(m.ReadBry("v")));
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static final String Invk_root_dir_ = "root_dir_", Invk_orig_dir_ = "orig_dir_", Invk_thumb_dir_ = "thumb_dir_";
|
||||
private Io_url To_url(byte[] v) {
|
||||
if (gplx.core.envs.Op_sys.Cur().Tid_is_wnt())
|
||||
v = Bry_.Replace(v, Byte_ascii.Slash, Byte_ascii.Backslash);
|
||||
return gplx.core.brys.fmtrs.Bry_fmtr_eval_mgr_.Eval_url(wiki.Appe().Url_cmd_eval(), v);
|
||||
}
|
||||
public static Fs_root_core New(Xow_file_mgr file_mgr, Xowe_wiki wiki) {
|
||||
Fs_root_core rv = new Fs_root_core(wiki);
|
||||
file_mgr.Fsdb_mgr_(rv);
|
||||
|
||||
file_mgr.Orig_mgr().Wkrs__del(gplx.xowa.files.origs.Xof_orig_wkr_.Tid_wmf_api);
|
||||
file_mgr.Orig_mgr().Wkrs__set(new Xof_orig_wkr__fs_root(rv.mgr.Wkr()));
|
||||
return rv;
|
||||
}
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.files.fsdb.fs_roots; import gplx.*; import gplx.xowa.*; import gplx.xowa.files.*; import gplx.xowa.files.fsdb.*;
|
||||
import gplx.core.ios.*; import gplx.core.brys.fmtrs.*; import gplx.core.envs.*;
|
||||
import gplx.fsdb.*; import gplx.fsdb.data.*; import gplx.fsdb.meta.*;
|
||||
import gplx.xowa.guis.cbks.js.*; import gplx.xowa.files.origs.*; import gplx.xowa.files.bins.*; import gplx.xowa.files.caches.*;
|
||||
public class Fs_root_fsdb_mgr implements Xof_fsdb_mgr, Gfo_invk { // read images from file-system dir
|
||||
private Xowe_wiki wiki; private Fs_root_wkr_fsdb fsdb_wkr;
|
||||
public Fs_root_fsdb_mgr(Xowe_wiki wiki) {this.Init_by_wiki(wiki); fsdb_wkr = new Fs_root_wkr_fsdb(wiki);}
|
||||
public void Init_by_wiki(Xow_wiki wiki) {this.wiki = (Xowe_wiki)wiki;}
|
||||
public void Fsdb_search_by_list(List_adp itms, Xow_wiki wiki, Xoa_page page, Xog_js_wkr js_wkr) {
|
||||
int itms_len = itms.Count();
|
||||
// Xou_cache_mgr cache_mgr = wiki.App().User().User_db_mgr().Cache_mgr(); // repo_id is 127; DATE:2015-08-23
|
||||
for (int i = 0; i < itms_len; i++) {
|
||||
Xof_fsdb_itm itm = (Xof_fsdb_itm)itms.Get_at(i);
|
||||
if (fsdb_wkr.Find_file(itm)) {
|
||||
Js_img_mgr.Update_img(page, js_wkr, itm);
|
||||
// cache_mgr.Update(itm);
|
||||
}
|
||||
}
|
||||
// cache_mgr.Db_save();
|
||||
}
|
||||
private Io_url Xto_url(byte[] v) {
|
||||
if (Op_sys.Cur().Tid_is_wnt())
|
||||
v = Bry_.Replace(v, Byte_ascii.Slash, Byte_ascii.Backslash);
|
||||
return Bry_fmtr_eval_mgr_.Eval_url(wiki.Appe().Url_cmd_eval(), v);
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_root_dir_)) fsdb_wkr.Root_dir_(Xto_url(m.ReadBry("v")));
|
||||
else if (ctx.Match(k, Invk_orig_dir_)) fsdb_wkr.Orig_dir_(Xto_url(m.ReadBry("v")));
|
||||
else if (ctx.Match(k, Invk_thumb_dir_)) fsdb_wkr.Thumb_dir_(Xto_url(m.ReadBry("v")));
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
} private static final String Invk_root_dir_ = "root_dir_", Invk_orig_dir_ = "orig_dir_", Invk_thumb_dir_ = "thumb_dir_";
|
||||
public Xof_bin_mgr Bin_mgr() {throw Err_.new_unimplemented();}
|
||||
public Fsm_mnt_mgr Mnt_mgr() {return null;}
|
||||
public void Rls() {}
|
||||
}
|
@ -18,20 +18,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.files.fsdb.fs_roots; import gplx.*; import gplx.xowa.*; import gplx.xowa.files.*; import gplx.xowa.files.fsdb.*;
|
||||
import gplx.core.primitives.*; import gplx.dbs.*; import gplx.dbs.cfgs.*;
|
||||
import gplx.xowa.files.repos.*; import gplx.fsdb.meta.*;
|
||||
public class Fs_root_wkr_fsdb {
|
||||
private Xowe_wiki wiki;
|
||||
class Fs_root_mgr {
|
||||
private final Xowe_wiki wiki;
|
||||
private final Fs_root_wkr wkr = new Fs_root_wkr();
|
||||
private final Xof_img_size img_size = new Xof_img_size();
|
||||
private final String_obj_ref tmp_resize_result = String_obj_ref.null_();
|
||||
private Io_url orig_dir, thumb_dir;
|
||||
private Fs_root_dir orig_dir_mgr = new Fs_root_dir();
|
||||
private String_obj_ref tmp_resize_result = String_obj_ref.null_();
|
||||
private Xof_img_size img_size = new Xof_img_size();
|
||||
public Fs_root_wkr_fsdb(Xowe_wiki wiki) {this.wiki = wiki;}
|
||||
public Fs_root_mgr(Xowe_wiki wiki) {
|
||||
this.wiki = wiki;
|
||||
}
|
||||
public Fs_root_wkr Wkr() {return wkr;}
|
||||
public boolean Find_file(Xof_fsdb_itm fsdb_itm) {
|
||||
byte[] orig_ttl = fsdb_itm.Orig_ttl();
|
||||
Orig_fil_itm orig_itm = orig_dir_mgr.Get_by_ttl(orig_ttl);
|
||||
if (orig_itm == Orig_fil_itm.Null) return false;
|
||||
Io_url orig_url = orig_itm.Fil_url();
|
||||
Orig_fil_row orig_itm = wkr.Get_by_ttl(orig_ttl);
|
||||
if (orig_itm == Orig_fil_row.Null) return false;
|
||||
fsdb_itm.Change_repo(Xof_repo_tid_.Tid__local, wiki.Domain_bry());
|
||||
Io_url orig_url = orig_itm.Url();
|
||||
if (fsdb_itm.File_is_orig()) {
|
||||
fsdb_itm.Html_size_(orig_itm.Fil_w(), orig_itm.Fil_h());
|
||||
fsdb_itm.Html_size_(orig_itm.W(), orig_itm.H());
|
||||
fsdb_itm.Html_view_url_(orig_url);
|
||||
fsdb_itm.Html_orig_url_(orig_url);
|
||||
return true;
|
||||
@ -39,9 +43,9 @@ public class Fs_root_wkr_fsdb {
|
||||
else {
|
||||
String thumb_rel = orig_url.GenRelUrl_orEmpty(orig_dir);
|
||||
int upright_patch = wiki.File_mgr().Patch_upright();
|
||||
img_size.Html_size_calc(fsdb_itm.Lnki_exec_tid(), fsdb_itm.Lnki_w(), fsdb_itm.Lnki_h(), fsdb_itm.Lnki_type(), upright_patch, fsdb_itm.Lnki_upright(), fsdb_itm.Orig_ext().Id(), orig_itm.Fil_w(), orig_itm.Fil_h(), Xof_img_size.Thumb_width_img);
|
||||
img_size.Html_size_calc(fsdb_itm.Lnki_exec_tid(), fsdb_itm.Lnki_w(), fsdb_itm.Lnki_h(), fsdb_itm.Lnki_type(), upright_patch, fsdb_itm.Lnki_upright(), fsdb_itm.Orig_ext().Id(), orig_itm.W(), orig_itm.H(), Xof_img_size.Thumb_width_img);
|
||||
int html_w = img_size.Html_w(), html_h = img_size.Html_h();
|
||||
String thumb_name = Int_.To_str(html_w) + orig_url.Ext();
|
||||
String thumb_name = Int_.To_str(html_w) + "." + String_.new_u8(fsdb_itm.Orig_ext().Ext_view());
|
||||
Io_url thumb_url = thumb_dir.GenSubFil_ary(thumb_rel + orig_url.Info().DirSpr(), thumb_name);
|
||||
if (!Io_mgr.Instance.ExistsFil(thumb_url)) {
|
||||
if (!wiki.Appe().File_mgr().Img_mgr().Wkr_resize_img().Resize_exec(orig_url, thumb_url, html_w, html_h, fsdb_itm.Orig_ext().Id(), tmp_resize_result))
|
||||
@ -64,7 +68,7 @@ public class Fs_root_wkr_fsdb {
|
||||
orig_dir_mgr_init(orig_dir);
|
||||
}
|
||||
private void orig_dir_mgr_init(Io_url orig_dir) {
|
||||
orig_dir_mgr.Init(orig_dir, new Orig_fil_tbl(), wiki.Appe().Usr_dlg(), wiki.Appe().File_mgr().Img_mgr().Wkr_query_img_size());
|
||||
wkr.Init(wiki.Appe().File_mgr().Img_mgr().Wkr_query_img_size(), orig_dir);
|
||||
}
|
||||
public void Thumb_dir_(Io_url v) {
|
||||
thumb_dir = v;
|
@ -19,77 +19,81 @@ package gplx.xowa.files.fsdb.fs_roots; import gplx.*; import gplx.xowa.*; import
|
||||
import gplx.core.primitives.*;
|
||||
import gplx.dbs.*; import gplx.dbs.cfgs.*; import gplx.gfui.*;
|
||||
import gplx.fsdb.meta.*; import gplx.xowa.files.imgs.*;
|
||||
class Fs_root_dir {
|
||||
private Gfo_usr_dlg usr_dlg; private Xof_img_wkr_query_img_size img_size_wkr;
|
||||
private Io_url url; private boolean recurse = true;
|
||||
class Fs_root_wkr {
|
||||
private Xof_img_wkr_query_img_size img_size_wkr;
|
||||
private Io_url orig_dir; private boolean recurse = true;
|
||||
private Orig_fil_mgr cache = new Orig_fil_mgr(), fs_fil_mgr;
|
||||
private Db_conn conn; private Db_cfg_tbl cfg_tbl; private Orig_fil_tbl fil_tbl;
|
||||
private Db_conn conn; private Db_cfg_tbl cfg_tbl;
|
||||
private Orig_fil_tbl orig_tbl;
|
||||
private int fil_id_next = 0;
|
||||
public void Init(Io_url url, Orig_fil_tbl fil_tbl, Gfo_usr_dlg usr_dlg, Xof_img_wkr_query_img_size img_size_wkr) {
|
||||
this.url = url;
|
||||
this.fil_tbl = fil_tbl; this.usr_dlg = usr_dlg; this.img_size_wkr = img_size_wkr;
|
||||
public Orig_fil_tbl Orig_tbl() {return orig_tbl;}
|
||||
public void Init(Xof_img_wkr_query_img_size img_size_wkr, Io_url orig_dir) {
|
||||
this.img_size_wkr = img_size_wkr;
|
||||
this.orig_dir = orig_dir;
|
||||
}
|
||||
public Orig_fil_itm Get_by_ttl(byte[] lnki_ttl) {
|
||||
Orig_fil_itm rv = (Orig_fil_itm)cache.Get_by_ttl(lnki_ttl);
|
||||
public Orig_fil_row Get_by_ttl(byte[] lnki_ttl) {
|
||||
Orig_fil_row rv = (Orig_fil_row)cache.Get_by_ttl(lnki_ttl);
|
||||
if (rv == null) {
|
||||
// not in mem; get from db
|
||||
rv = Get_from_db(lnki_ttl);
|
||||
// not in db; get from fsys
|
||||
if (rv == null) {
|
||||
rv = Get_from_fs(lnki_ttl);
|
||||
if (rv == null) return Orig_fil_itm.Null;
|
||||
if (rv == null) return Orig_fil_row.Null;
|
||||
}
|
||||
cache.Add(rv);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
private Orig_fil_itm Get_from_db(byte[] lnki_ttl) {
|
||||
if (conn == null) conn = Init_db_fil_mgr();
|
||||
Orig_fil_itm rv = fil_tbl.Select_itm(lnki_ttl);
|
||||
if (rv == null) return Orig_fil_itm.Null; // not in db
|
||||
return rv;
|
||||
private Orig_fil_row Get_from_db(byte[] lnki_ttl) {
|
||||
if (conn == null) conn = Init_orig_db();
|
||||
return orig_tbl.Select_itm_or_null(orig_dir, lnki_ttl);
|
||||
}
|
||||
private Orig_fil_itm Get_from_fs(byte[] lnki_ttl) {
|
||||
private Orig_fil_row Get_from_fs(byte[] lnki_ttl) {
|
||||
if (fs_fil_mgr == null) fs_fil_mgr = Init_fs_fil_mgr();
|
||||
Orig_fil_itm rv = fs_fil_mgr.Get_by_ttl(lnki_ttl);
|
||||
if (rv == null) return Orig_fil_itm.Null; // not in fs
|
||||
Orig_fil_row rv = fs_fil_mgr.Get_by_ttl(lnki_ttl);
|
||||
if (rv == null) return Orig_fil_row.Null; // not in fs
|
||||
SizeAdp img_size = SizeAdp_.Zero;
|
||||
if (Xof_ext_.Id_is_image(rv.Fil_ext_id()))
|
||||
img_size = img_size_wkr.Exec(rv.Fil_url());
|
||||
rv.Init_by_size(++fil_id_next, img_size.Width(), img_size.Height());
|
||||
if (Xof_ext_.Id_is_image(rv.Ext_id()))
|
||||
img_size = img_size_wkr.Exec(rv.Url());
|
||||
rv.Init_by_fs(++fil_id_next, img_size.Width(), img_size.Height());
|
||||
cfg_tbl.Update_int(Cfg_grp_root_dir, Cfg_key_fil_id_next, fil_id_next);
|
||||
fil_tbl.Insert(rv);
|
||||
String fil_orig_dir = "~{orig_dir}" + rv.Url().OwnerDir().GenRelUrl_orEmpty(orig_dir); // converts "/xowa/wiki/custom_wiki/file/orig/7/70/A.png" -> "~{orig_dir}7/70/"
|
||||
orig_tbl.Insert(rv, fil_orig_dir);
|
||||
return rv;
|
||||
}
|
||||
private Orig_fil_mgr Init_fs_fil_mgr() { // NOTE: need to read entire dir, b/c ttl may be "A.png", but won't know which subdir
|
||||
Orig_fil_mgr rv = new Orig_fil_mgr();
|
||||
Io_url[] fils = Io_mgr.Instance.QueryDir_args(url).Recur_(recurse).ExecAsUrlAry();
|
||||
Io_url[] fils = Io_mgr.Instance.QueryDir_args(orig_dir).Recur_(recurse).ExecAsUrlAry();
|
||||
int fils_len = fils.length;
|
||||
for (int i = 0; i < fils_len; i++) {
|
||||
Io_url fil = fils[i];
|
||||
byte[] fil_name_bry = Xto_fil_bry(fil);
|
||||
Orig_fil_itm fil_itm = rv.Get_by_ttl(fil_name_bry);
|
||||
if (fil_itm != Orig_fil_itm.Null) {
|
||||
usr_dlg.Warn_many("", "", "file already exists: cur=~{0} new=~{1}", fil_itm.Fil_url().Raw(), fil.Raw());
|
||||
byte[] fil_name_bry = To_fil_bry(fil);
|
||||
Orig_fil_row fil_itm = rv.Get_by_ttl(fil_name_bry);
|
||||
if (fil_itm != Orig_fil_row.Null) {
|
||||
Gfo_usr_dlg_.Instance.Warn_many("", "", "file already exists: cur=~{0} new=~{1}", fil_itm.Url().Raw(), fil.Raw());
|
||||
continue;
|
||||
}
|
||||
Xof_ext ext = Xof_ext_.new_by_ttl_(fil_name_bry);
|
||||
fil_itm = new Orig_fil_itm().Init_by_make(fil, fil_name_bry, ext.Id());
|
||||
fil_itm = Orig_fil_row.New_by_fs(fil, fil_name_bry, ext.Id());
|
||||
rv.Add(fil_itm);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
private Db_conn Init_db_fil_mgr() {
|
||||
Io_url db_url = url.GenSubFil("^orig_regy.sqlite3");
|
||||
private Db_conn Init_orig_db() {
|
||||
Io_url orig_db = orig_dir.GenSubFil("^orig_regy.sqlite3");
|
||||
boolean created = false; boolean schema_is_1 = Bool_.Y;
|
||||
Db_conn conn = Db_conn_bldr.Instance.Get(db_url);
|
||||
Db_conn conn = Db_conn_bldr.Instance.Get(orig_db);
|
||||
if (conn == null) {
|
||||
conn = Db_conn_bldr.Instance.New(db_url);
|
||||
conn = Db_conn_bldr.Instance.New(orig_db);
|
||||
created = true;
|
||||
}
|
||||
cfg_tbl = new Db_cfg_tbl(conn, schema_is_1 ? "fsdb_cfg" : gplx.xowa.wikis.data.Xowd_cfg_tbl_.Tbl_name);
|
||||
fil_tbl.Conn_(conn, created, schema_is_1);
|
||||
orig_tbl = new Orig_fil_tbl(conn, schema_is_1);
|
||||
if (created) {
|
||||
cfg_tbl.Create_tbl();
|
||||
cfg_tbl.Insert_int(Cfg_grp_root_dir, Cfg_key_fil_id_next, fil_id_next);
|
||||
orig_tbl.Create_tbl();
|
||||
}
|
||||
else {
|
||||
fil_id_next = cfg_tbl.Select_int(Cfg_grp_root_dir, Cfg_key_fil_id_next);
|
||||
@ -98,10 +102,11 @@ class Fs_root_dir {
|
||||
}
|
||||
public void Rls() {
|
||||
cfg_tbl.Rls();
|
||||
fil_tbl.Rls();
|
||||
orig_tbl.Rls();
|
||||
}
|
||||
private static final String Cfg_grp_root_dir = "xowa.root_dir", Cfg_key_fil_id_next = "fil_id_next";
|
||||
public static byte[] Xto_fil_bry(Io_url url) {
|
||||
public static final String Url_orig_dir = "~{orig_dir}";
|
||||
public static byte[] To_fil_bry(Io_url url) {
|
||||
byte[] rv = Bry_.new_u8(url.NameAndExt());
|
||||
rv = Bry_.Replace(rv, Byte_ascii.Space, Byte_ascii.Underline);
|
||||
rv = Bry_.Ucase__1st(rv);
|
@ -19,12 +19,12 @@ package gplx.xowa.files.fsdb.fs_roots; import gplx.*; import gplx.xowa.*; import
|
||||
import org.junit.*;
|
||||
import gplx.dbs.*; import gplx.dbs.cfgs.*; import gplx.xowa.files.imgs.*;
|
||||
import gplx.fsdb.meta.*;
|
||||
public class Fs_root_dir_tst {
|
||||
@Before public void init() {fxt.Reset();} private Fs_root_dir_fxt fxt = new Fs_root_dir_fxt();
|
||||
public class Fs_root_wkr_tst {
|
||||
@Before public void init() {fxt.Reset();} private Fs_root_wkr_fxt fxt = new Fs_root_wkr_fxt();
|
||||
@Test public void Basic() {
|
||||
fxt.Init_fs("mem/dir/A.png", 200, 100);
|
||||
fxt.Test_get("A.png", fxt.itm_().Url_("mem/dir/A.png").Size_(200, 100));
|
||||
fxt.Test_db("A.png", fxt.itm_().Init(1, "mem/dir/A.png", 200, 100));
|
||||
fxt.Init_fs("mem/dir/7/70/A.png", 200, 100);
|
||||
fxt.Test_get("A.png", fxt.itm_().Url_("mem/dir/7/70/A.png").Size_(200, 100));
|
||||
fxt.Test_db("A.png", fxt.itm_().Init(1, "mem/dir/7/70/A.png", 200, 100));
|
||||
}
|
||||
@Test public void Recurse() {
|
||||
fxt.Init_fs("mem/dir/sub1/A1.png", 200, 100);
|
||||
@ -36,27 +36,25 @@ public class Fs_root_dir_tst {
|
||||
fxt.Test_xto_fil_bry("/dir/a.png" , "A.png"); // title
|
||||
}
|
||||
}
|
||||
class Fs_root_dir_fxt {
|
||||
private Fs_root_dir root_dir = new Fs_root_dir();
|
||||
private Orig_fil_tbl orig_fil_tbl;
|
||||
class Fs_root_wkr_fxt {
|
||||
private Fs_root_wkr root_dir = new Fs_root_wkr();
|
||||
private Io_url url;
|
||||
public void Reset() {
|
||||
Db_conn_bldr.Instance.Reg_default_mem();
|
||||
Io_mgr.Instance.InitEngine_mem();
|
||||
url = Io_url_.mem_dir_("mem/dir/");
|
||||
root_dir = new Fs_root_dir();
|
||||
orig_fil_tbl = new Orig_fil_tbl();
|
||||
root_dir = new Fs_root_wkr();
|
||||
Xof_img_wkr_query_img_size img_size_wkr = new Xof_img_wkr_query_img_size_test();
|
||||
root_dir.Init(url, orig_fil_tbl, Gfo_usr_dlg_.Noop, img_size_wkr);
|
||||
root_dir.Init(img_size_wkr, url);
|
||||
}
|
||||
public Orig_fil_mok itm_() {return new Orig_fil_mok();}
|
||||
public void Init_fs(String url, int w, int h) {Save_img(url, w, h);}
|
||||
public void Test_get(String name, Orig_fil_mok expd) {
|
||||
Orig_fil_itm actl = root_dir.Get_by_ttl(Bry_.new_u8(name));
|
||||
Orig_fil_row actl = root_dir.Get_by_ttl(Bry_.new_u8(name));
|
||||
expd.Test(actl);
|
||||
}
|
||||
public void Test_db(String ttl, Orig_fil_mok expd) {
|
||||
Orig_fil_itm actl = orig_fil_tbl.Select_itm(Bry_.new_u8(ttl));
|
||||
Orig_fil_row actl = root_dir.Orig_tbl().Select_itm_or_null(url, Bry_.new_u8(ttl));
|
||||
expd.Test(actl);
|
||||
}
|
||||
public static void Save_img(String url, int w, int h) {
|
||||
@ -65,7 +63,7 @@ class Fs_root_dir_fxt {
|
||||
}
|
||||
public void Test_xto_fil_bry(String url_str, String expd) {
|
||||
Io_url url = Io_url_.new_fil_(url_str);
|
||||
Tfds.Eq(expd, String_.new_u8(Fs_root_dir.Xto_fil_bry(url)));
|
||||
Tfds.Eq(expd, String_.new_u8(Fs_root_wkr.To_fil_bry(url)));
|
||||
}
|
||||
}
|
||||
class Orig_fil_mok {
|
||||
@ -83,13 +81,13 @@ class Orig_fil_mok {
|
||||
this.ext_id = Xof_ext_.new_by_ttl_(Bry_.new_u8(name)).Id();
|
||||
return this;
|
||||
}
|
||||
public void Test(Orig_fil_itm actl) {
|
||||
public void Test(Orig_fil_row actl) {
|
||||
if (actl == null) Tfds.Fail("actl itm is null");
|
||||
if (w != -1) Tfds.Eq(w, actl.Fil_w());
|
||||
if (h != -1) Tfds.Eq(h, actl.Fil_h());
|
||||
if (url != null) Tfds.Eq(url, actl.Fil_url().Raw());
|
||||
if (uid != -1) Tfds.Eq(uid, actl.Fil_uid());
|
||||
if (ext_id != -1) Tfds.Eq(uid, actl.Fil_ext_id());
|
||||
if (name != null) Tfds.Eq(name, String_.new_u8(actl.Fil_name()));
|
||||
if (w != -1) Tfds.Eq(w, actl.W());
|
||||
if (h != -1) Tfds.Eq(h, actl.H());
|
||||
if (url != null) Tfds.Eq(url, actl.Url().Raw());
|
||||
if (uid != -1) Tfds.Eq(uid, actl.Uid());
|
||||
if (ext_id != -1) Tfds.Eq(uid, actl.Ext_id());
|
||||
if (name != null) Tfds.Eq(name, String_.new_u8(actl.Name()));
|
||||
}
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.files.fsdb.fs_roots; import gplx.*; import gplx.xowa.*; import gplx.xowa.files.*; import gplx.xowa.files.fsdb.*;
|
||||
public class Orig_fil_itm {
|
||||
public Orig_fil_itm() {}
|
||||
public Orig_fil_itm(int uid, byte[] name, int ext_id, int w, int h, byte[] dir_url) {
|
||||
this.fil_uid = uid; this.fil_name = name; this.fil_ext_id = ext_id; this.fil_w = w; this.fil_h = h; this.fil_dir_url = dir_url;
|
||||
}
|
||||
public int Fil_uid() {return fil_uid;} private int fil_uid;
|
||||
public byte[] Fil_name() {return fil_name;} private byte[] fil_name;
|
||||
public int Fil_ext_id() {return fil_ext_id;} private int fil_ext_id;
|
||||
public int Fil_w() {return fil_w;} private int fil_w;
|
||||
public int Fil_h() {return fil_h;} private int fil_h;
|
||||
public byte[] Fil_dir_url() {return fil_dir_url;} private byte[] fil_dir_url;
|
||||
public Io_url Fil_url() {
|
||||
if (fil_url == null) {
|
||||
byte[] fil_url_bry = Bry_.Add(fil_dir_url, fil_name);
|
||||
fil_url = Io_url_.new_fil_(String_.new_u8(fil_url_bry));
|
||||
}
|
||||
return fil_url;
|
||||
} private Io_url fil_url;
|
||||
public Orig_fil_itm Init_by_make(Io_url url, byte[] name_bry, int ext_id) {
|
||||
this.fil_url = url;
|
||||
this.fil_name = name_bry;
|
||||
this.fil_dir_url = Bry_.new_u8(url.OwnerDir().Raw());
|
||||
this.fil_ext_id = ext_id;
|
||||
return this;
|
||||
}
|
||||
public Orig_fil_itm Init_by_size(int uid, int w, int h) {this.fil_uid = uid; this.fil_w = w; this.fil_h = h; return this;}
|
||||
public static final Orig_fil_itm Null = null;
|
||||
}
|
@ -17,8 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.files.fsdb.fs_roots; import gplx.*; import gplx.xowa.*; import gplx.xowa.files.*; import gplx.xowa.files.fsdb.*;
|
||||
class Orig_fil_mgr {
|
||||
private Ordered_hash hash = Ordered_hash_.New_bry();
|
||||
private final Ordered_hash hash = Ordered_hash_.New_bry();
|
||||
public boolean Has(byte[] lnki_ttl) {return hash.Has(lnki_ttl);}
|
||||
public Orig_fil_itm Get_by_ttl(byte[] lnki_ttl) {return (Orig_fil_itm)hash.Get_by(lnki_ttl);}
|
||||
public void Add(Orig_fil_itm fil) {hash.Add(fil.Fil_name(), fil);}
|
||||
public Orig_fil_row Get_by_ttl(byte[] lnki_ttl) {return (Orig_fil_row)hash.Get_by(lnki_ttl);}
|
||||
public void Add(Orig_fil_row fil) {hash.Add(fil.Name(), fil);}
|
||||
}
|
||||
|
47
400_xowa/src/gplx/xowa/files/fsdb/fs_roots/Orig_fil_row.java
Normal file
47
400_xowa/src/gplx/xowa/files/fsdb/fs_roots/Orig_fil_row.java
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.files.fsdb.fs_roots; import gplx.*; import gplx.xowa.*; import gplx.xowa.files.*; import gplx.xowa.files.fsdb.*;
|
||||
class Orig_fil_row {
|
||||
Orig_fil_row(int uid, byte[] name, int ext_id, int w, int h, Io_url url) {
|
||||
this.uid = uid;
|
||||
this.name = name;
|
||||
this.ext_id = ext_id;
|
||||
this.w = w;
|
||||
this.h = h;
|
||||
this.url = url;
|
||||
}
|
||||
public int Uid() {return uid;} private int uid;
|
||||
public byte[] Name() {return name;} private final byte[] name;
|
||||
public int Ext_id() {return ext_id;} private final int ext_id;
|
||||
public int W() {return w;} private int w;
|
||||
public int H() {return h;} private int h;
|
||||
public Io_url Url() {return url;} private final Io_url url;
|
||||
|
||||
public Orig_fil_row Init_by_fs(int uid, int w, int h) {
|
||||
this.uid = uid; this.w = w; this.h = h;
|
||||
return this;
|
||||
}
|
||||
|
||||
public static final Orig_fil_row Null = null;
|
||||
public static Orig_fil_row New_by_db(int uid, byte[] name, int ext_id, int w, int h, Io_url dir) {
|
||||
return new Orig_fil_row(uid, name, ext_id, w, h, dir.GenSubFil(String_.new_u8(name)));
|
||||
}
|
||||
public static Orig_fil_row New_by_fs(Io_url url, byte[] name, int ext_id) {
|
||||
return new Orig_fil_row(0, name, ext_id, 0, 0, url);
|
||||
}
|
||||
}
|
@ -17,65 +17,63 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.files.fsdb.fs_roots; import gplx.*; import gplx.xowa.*; import gplx.xowa.files.*; import gplx.xowa.files.fsdb.*;
|
||||
import gplx.dbs.*;
|
||||
public class Orig_fil_tbl implements Rls_able {
|
||||
private String tbl_name = "orig_fil"; private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
|
||||
class Orig_fil_tbl implements Rls_able {
|
||||
private final Db_conn conn;
|
||||
private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
|
||||
private String tbl_name = "orig_fil";
|
||||
private String fld_uid, fld_name, fld_ext_id, fld_w, fld_h, fld_dir_url;
|
||||
private Db_conn conn; private Db_stmt stmt_insert, stmt_select;
|
||||
public void Conn_(Db_conn new_conn, boolean created, boolean schema_is_1) {
|
||||
this.conn = new_conn; flds.Clear();
|
||||
String fld_prefix = "";
|
||||
if (schema_is_1) {
|
||||
fld_prefix = "fil_";
|
||||
}
|
||||
private Db_stmt stmt_insert, stmt_select;
|
||||
public Orig_fil_tbl(Db_conn conn, boolean schema_is_1) {
|
||||
this.conn = conn; conn.Rls_reg(this);
|
||||
String fld_prefix = schema_is_1 ? "fil_" : "";
|
||||
fld_uid = flds.Add_int(fld_prefix + "uid");
|
||||
fld_name = flds.Add_str(fld_prefix + "name", 1024);
|
||||
fld_ext_id = flds.Add_int(fld_prefix + "ext_id");
|
||||
fld_w = flds.Add_int(fld_prefix + "w");
|
||||
fld_h = flds.Add_int(fld_prefix + "h");
|
||||
fld_dir_url = flds.Add_str(fld_prefix + "dir_url", 1024); // NOTE: don't put dir in separate table; note that entire root_dir_wkr is not built to scale due to need for recursively loading all files
|
||||
if (created) {
|
||||
Dbmeta_tbl_itm meta = Dbmeta_tbl_itm.New(tbl_name, flds
|
||||
, Dbmeta_idx_itm.new_unique_by_tbl(tbl_name, "main", fld_name)
|
||||
);
|
||||
conn.Meta_tbl_create(meta);
|
||||
}
|
||||
stmt_insert = stmt_select = null;
|
||||
conn.Rls_reg(this);
|
||||
}
|
||||
public void Create_tbl() {
|
||||
conn.Meta_tbl_create(Dbmeta_tbl_itm.New(tbl_name, flds
|
||||
, Dbmeta_idx_itm.new_unique_by_tbl(tbl_name, "main", fld_name)
|
||||
));
|
||||
}
|
||||
public void Rls() {
|
||||
stmt_insert = Db_stmt_.Rls(stmt_insert);
|
||||
stmt_select = Db_stmt_.Rls(stmt_select);
|
||||
}
|
||||
public Orig_fil_itm Select_itm(byte[] ttl) {
|
||||
public Orig_fil_row Select_itm_or_null(Io_url dir, byte[] ttl) {
|
||||
if (stmt_select == null) stmt_select = conn.Stmt_select(tbl_name, flds, fld_name);
|
||||
Orig_fil_itm rv = Orig_fil_itm.Null;
|
||||
Db_rdr rdr = stmt_select.Clear().Crt_bry_as_str(fld_name, ttl).Exec_select__rls_manual();
|
||||
try {
|
||||
if (rdr.Move_next())
|
||||
rv = Load_itm(rdr);
|
||||
return rv;
|
||||
}
|
||||
try {return rdr.Move_next() ? Load_itm(rdr, dir) : Orig_fil_row.Null;}
|
||||
finally {rdr.Rls();}
|
||||
}
|
||||
private Orig_fil_itm Load_itm(Db_rdr rdr) {
|
||||
return new Orig_fil_itm
|
||||
private Orig_fil_row Load_itm(Db_rdr rdr, Io_url orig_root) {
|
||||
String name = rdr.Read_str(fld_name);
|
||||
String fil_orig_dir = rdr.Read_str(fld_dir_url);
|
||||
Io_url dir = String_.Has_at_bgn(fil_orig_dir, Fs_root_wkr.Url_orig_dir)
|
||||
// swap out orig_dir; EX: "~{orig_dir}7/70/" -> "/xowa/wiki/custom_wiki/file/orig/7/70/"
|
||||
? Io_url_.new_dir_(orig_root.Raw() + String_.Mid(fil_orig_dir, String_.Len(Fs_root_wkr.Url_orig_dir)))
|
||||
// load literally; EX: "/xowa/wiki/custom_wiki/file/orig/7/70/"
|
||||
: Io_url_.new_dir_(fil_orig_dir);
|
||||
return Orig_fil_row.New_by_db
|
||||
( rdr.Read_int(fld_uid)
|
||||
, rdr.Read_bry_by_str(fld_name)
|
||||
, Bry_.new_u8(name)
|
||||
, rdr.Read_int(fld_ext_id)
|
||||
, rdr.Read_int(fld_w)
|
||||
, rdr.Read_int(fld_h)
|
||||
, rdr.Read_bry_by_str(fld_dir_url)
|
||||
, dir
|
||||
);
|
||||
}
|
||||
public void Insert(Orig_fil_itm fil_itm) {
|
||||
public void Insert(Orig_fil_row row, String dir) {
|
||||
if (stmt_insert == null) stmt_insert = conn.Stmt_insert(tbl_name, flds);
|
||||
stmt_insert.Clear()
|
||||
.Val_int(fld_uid, fil_itm.Fil_uid())
|
||||
.Val_bry_as_str(fld_name, fil_itm.Fil_name())
|
||||
.Val_int(fld_ext_id, fil_itm.Fil_ext_id())
|
||||
.Val_int(fld_w, fil_itm.Fil_w())
|
||||
.Val_int(fld_h, fil_itm.Fil_h())
|
||||
.Val_bry_as_str(fld_dir_url, fil_itm.Fil_dir_url())
|
||||
.Val_int (fld_uid , row.Uid())
|
||||
.Val_bry_as_str(fld_name , row.Name())
|
||||
.Val_int (fld_ext_id , row.Ext_id())
|
||||
.Val_int (fld_w , row.W())
|
||||
.Val_int (fld_h , row.H())
|
||||
.Val_str (fld_dir_url , dir)
|
||||
.Exec_insert();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.files.fsdb.fs_roots; import gplx.*; import gplx.xowa.*; import gplx.xowa.files.*; import gplx.xowa.files.fsdb.*;
|
||||
import gplx.dbs.*;
|
||||
import gplx.xowa.files.origs.*;
|
||||
class Xof_orig_wkr__fs_root implements Xof_orig_wkr {
|
||||
private final Fs_root_wkr wkr;
|
||||
public Xof_orig_wkr__fs_root(Fs_root_wkr wkr) {this.wkr = wkr;}
|
||||
public byte Tid() {return Xof_orig_wkr_.Tid_fs_root;}
|
||||
public void Find_by_list(Ordered_hash rv, List_adp itms) {Xof_orig_wkr_.Find_by_list(this, rv, itms);}
|
||||
public Xof_orig_itm Find_as_itm(byte[] ttl, int list_idx, int list_len) {
|
||||
Orig_fil_row orig_row = wkr.Get_by_ttl(ttl);
|
||||
if (orig_row == Orig_fil_row.Null) return Xof_orig_itm.Null;
|
||||
|
||||
Xof_orig_itm rv = new Xof_orig_itm
|
||||
( gplx.xowa.files.repos.Xof_repo_tid_.Tid__local
|
||||
, ttl
|
||||
, Xof_ext_.new_by_ttl_(ttl).Id()
|
||||
, orig_row.W()
|
||||
, orig_row.H()
|
||||
, null
|
||||
);
|
||||
return rv;
|
||||
}
|
||||
public boolean Add_orig(byte repo, byte[] page, int ext_id, int w, int h, byte[] redirect) {return false;}
|
||||
public void Db_txn_save() {}
|
||||
public void Db_rls() {}
|
||||
}
|
@ -43,14 +43,9 @@ public class Xof_orig_tbl implements Db_tbl {
|
||||
public void Create_tbl() {conn.Meta_tbl_create(Dbmeta_tbl_itm.New(tbl_name, flds, Dbmeta_idx_itm.new_normal_by_tbl(tbl_name, "main", fld_ttl)));}
|
||||
public void Select_by_list(Ordered_hash rv, List_adp itms) {select_in_wkr.Init(rv, itms).Select_in(Cancelable_.Never, conn, 0, itms.Count());}
|
||||
public Xof_orig_itm Select_itm(byte[] ttl) {
|
||||
Xof_orig_itm rv = Xof_orig_itm.Null;
|
||||
Db_rdr rdr = conn.Stmt_select(tbl_name, flds, fld_ttl).Clear().Crt_bry_as_str(fld_ttl, ttl).Exec_select__rls_auto();
|
||||
try {
|
||||
if (rdr.Move_next())
|
||||
rv = Load_by_rdr(rdr);
|
||||
}
|
||||
try {return rdr.Move_next() ? Load_by_rdr(rdr) : Xof_orig_itm.Null;}
|
||||
finally {rdr.Rls();}
|
||||
return rv;
|
||||
}
|
||||
public boolean Exists__repo_ttl(byte repo, byte[] ttl) {
|
||||
Db_rdr rdr = conn.Stmt_select(tbl_name, flds, fld_repo, fld_ttl).Crt_byte(fld_repo, repo).Crt_bry_as_str(fld_ttl, ttl).Exec_select__rls_auto();
|
||||
|
@ -36,5 +36,6 @@ public class Xof_orig_wkr_ {
|
||||
, Tid_xowa_meta = 3
|
||||
, Tid_xowa_img_links = 4
|
||||
, Tid_mock = 5
|
||||
, Tid_fs_root = 6
|
||||
;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user