mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
Allow hxtn command to be run multiple times during xomp_resume [#482]
This commit is contained in:
parent
3b6efe4274
commit
c459454da3
@ -35,8 +35,9 @@ class Xomp_make_hxtn {
|
||||
Xomp_wkr_db wkr_db = Xomp_wkr_db.New(mgr_db.Dir(), i);
|
||||
|
||||
// insert page_tbl
|
||||
page_tbl.Conn().Env_db_attach("wkr_db", wkr_db.Url());
|
||||
page_tbl.Conn().Txn_bgn("hxtn_page");
|
||||
Db_rdr rdr = wkr_db.Conn().Stmt_sql("SELECT * FROM hxtn_page;").Exec_select__rls_auto(); // ANSI.Y
|
||||
Db_rdr rdr = page_tbl.Conn().Stmt_sql("SELECT DISTINCT src.page_id, src.wkr_id, src.data_id FROM wkr_db.hxtn_page src LEFT JOIN hxtn_page trg ON src.page_id = trg.page_id AND src.wkr_id = trg.wkr_id AND src.data_id = trg.data_id WHERE trg.id IS NULL;").Exec_select__rls_auto(); // ANSI.Y
|
||||
try {
|
||||
while (rdr.Move_next()) {
|
||||
page_tbl.Insert_by_rdr(rdr);
|
||||
@ -47,12 +48,13 @@ class Xomp_make_hxtn {
|
||||
}
|
||||
} finally {rdr.Rls();}
|
||||
page_tbl.Conn().Txn_end();
|
||||
page_tbl.Conn().Env_db_detach("wkr_db");
|
||||
|
||||
// insert blob tbl; note that dupes can exist across wkr_dbs (wkr_db 1 and wkr_db 2 both have Template:Abcd)
|
||||
count = 0;
|
||||
blob_tbl.Conn().Env_db_attach("wkr_db", wkr_db.Url());
|
||||
blob_tbl.Conn().Txn_bgn("hxtn_blob");
|
||||
rdr = blob_tbl.Conn().Stmt_sql("SELECT src.* FROM wkr_db.hxtn_blob src LEFT JOIN hxtn_blob trg ON src.wiki_id = trg.wiki_id AND src.blob_id = trg.blob_id AND src.blob_tid = trg.blob_tid WHERE trg.blob_id IS NULL;").Exec_select__rls_auto(); // ANSI.Y
|
||||
rdr = blob_tbl.Conn().Stmt_sql("SELECT DISTINCT src.blob_tid, src.wiki_id, src.blob_id, src.zip_tid, src.blob_data FROM wkr_db.hxtn_blob src LEFT JOIN hxtn_blob trg ON src.wiki_id = trg.wiki_id AND src.blob_id = trg.blob_id AND src.blob_tid = trg.blob_tid WHERE trg.blob_id IS NULL;").Exec_select__rls_auto(); // ANSI.Y
|
||||
try {
|
||||
while (rdr.Move_next()) {
|
||||
blob_tbl.Insert_by_rdr(rdr);
|
||||
|
@ -40,7 +40,8 @@ public class Hxtn_blob_tbl implements Rls_able {
|
||||
}
|
||||
public void Stmt_end() {
|
||||
this.Rls();
|
||||
conn.Meta_idx_create(Dbmeta_idx_itm.new_unique_by_tbl(tbl_name, "pkey", fld_blob_id, fld_wiki_id, fld_blob_tid));
|
||||
if (!conn.Meta_idx_exists(tbl_name, "pkey"))
|
||||
conn.Meta_idx_create(Dbmeta_idx_itm.new_unique_by_tbl(tbl_name, "pkey", fld_blob_id, fld_wiki_id, fld_blob_tid));
|
||||
}
|
||||
public void Insert_by_rdr(Db_rdr rdr) {
|
||||
Db_stmt_.Insert_by_rdr(flds, rdr, stmt_insert);
|
||||
|
@ -38,7 +38,8 @@ public class Hxtn_page_tbl implements Rls_able {
|
||||
}
|
||||
public void Stmt_end() {
|
||||
this.Rls();
|
||||
conn.Meta_idx_create(Dbmeta_idx_itm.new_unique_by_tbl(tbl_name, "pkey", fld_page_id, fld_wkr_id, fld_data_id));
|
||||
if (!conn.Meta_idx_exists(tbl_name, "pkey"))
|
||||
conn.Meta_idx_create(Dbmeta_idx_itm.new_unique_by_tbl(tbl_name, "pkey", fld_page_id, fld_wkr_id, fld_data_id));
|
||||
}
|
||||
public void Insert_by_rdr(Db_rdr rdr) {
|
||||
Db_stmt_.Insert_by_rdr(flds, rdr, stmt_insert);
|
||||
|
@ -19,9 +19,11 @@ public class Hxtn_wiki_mgr {
|
||||
private Hxtn_wiki_tbl wiki_tbl;
|
||||
public void Init_by_xomp_merge(Db_conn conn, String wiki_domain) {
|
||||
wiki_tbl = new Hxtn_wiki_tbl(conn);
|
||||
wiki_tbl.Create_tbl();
|
||||
wiki_tbl.Insert(Hxtn_wiki_itm.Tid__self , wiki_domain);
|
||||
wiki_tbl.Insert(Hxtn_wiki_itm.Tid__commons , "commons.wikimedia.org");
|
||||
wiki_tbl.Insert(Hxtn_wiki_itm.Tid__wikidata, "www.wikidata.org");
|
||||
if (!conn.Meta_tbl_exists(wiki_tbl.Tbl_name())) {
|
||||
wiki_tbl.Create_tbl();
|
||||
wiki_tbl.Insert(Hxtn_wiki_itm.Tid__self , wiki_domain);
|
||||
wiki_tbl.Insert(Hxtn_wiki_itm.Tid__commons , "commons.wikimedia.org");
|
||||
wiki_tbl.Insert(Hxtn_wiki_itm.Tid__wikidata, "www.wikidata.org");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ public class Hxtn_wiki_tbl implements Rls_able {
|
||||
this.conn = conn;
|
||||
conn.Rls_reg(this);
|
||||
}
|
||||
public String Tbl_name() {return tbl_name;}
|
||||
public void Create_tbl() {
|
||||
conn.Meta_tbl_create(Dbmeta_tbl_itm.New(tbl_name, flds));
|
||||
}
|
||||
|
@ -20,8 +20,10 @@ public class Hxtn_wkr_mgr {
|
||||
private Hxtn_wkr_tbl wkr_tbl;
|
||||
public void Init_by_xomp_merge(Db_conn conn) {
|
||||
wkr_tbl = new Hxtn_wkr_tbl(conn);
|
||||
wkr_tbl.Create_tbl();
|
||||
Reg_wkr(new gplx.xowa.xtns.template_styles.Hxtn_page_wkr__template_styles(null)); // TODO:do formal registration of extensions; WHEN: rework tkn_mkr
|
||||
if (!conn.Meta_tbl_exists(wkr_tbl.Tbl_name())) {
|
||||
wkr_tbl.Create_tbl();
|
||||
Reg_wkr(new gplx.xowa.xtns.template_styles.Hxtn_page_wkr__template_styles(null)); // TODO:do formal registration of extensions; WHEN: rework tkn_mkr
|
||||
}
|
||||
}
|
||||
private void Reg_wkr(Hxtn_page_wkr wkr) {
|
||||
wkr_tbl.Insert(wkr.Id(), wkr.Key());
|
||||
|
@ -26,6 +26,7 @@ public class Hxtn_wkr_tbl implements Rls_able {
|
||||
this.conn = conn;
|
||||
conn.Rls_reg(this);
|
||||
}
|
||||
public String Tbl_name() {return tbl_name;}
|
||||
public void Create_tbl() {
|
||||
conn.Meta_tbl_create(Dbmeta_tbl_itm.New(tbl_name, flds));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user