mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
Personal_wikis: Add page delete; refactor category updates
This commit is contained in:
@@ -32,11 +32,13 @@ public class Xowd_site_stats_tbl implements Db_tbl {
|
||||
conn.Meta_tbl_create(Dbmeta_tbl_itm.New(tbl_name, flds));
|
||||
conn.Stmt_insert(tbl_name, flds).Val_int(fld_row_id, Site_stats_row_id).Val_long(fld_good_articles, 0).Val_long(fld_total_pages, 0).Val_int(fld_images, 0).Exec_insert();
|
||||
}
|
||||
public void Update(int num_articles, int num_pages, int num_files) {
|
||||
public void Update(long num_articles, long num_pages, int num_files) {
|
||||
Gfo_usr_dlg_.Instance.Log_many("", "", "db.site_stats: update started: num_articles=~{0} num_pages=~{1} num_files=~{2}", num_articles, num_pages, num_files);
|
||||
Db_stmt stmt = conn.Stmt_update(tbl_name, String_.Ary(fld_row_id), fld_good_articles, fld_total_pages, fld_images);
|
||||
stmt.Val_long(fld_good_articles, num_articles).Val_long(fld_total_pages, num_pages).Val_int(fld_images, num_files)
|
||||
.Crt_int(fld_row_id, Site_stats_row_id)
|
||||
.Exec_update();
|
||||
Gfo_usr_dlg_.Instance.Log_many("", "", "db.site_stats: update done");
|
||||
}
|
||||
public void Select(Xowd_site_stats_mgr stats) {
|
||||
Db_rdr rdr = conn.Stmt_select(tbl_name, flds, fld_row_id).Crt_int(fld_row_id, Site_stats_row_id).Exec_select__rls_auto();
|
||||
|
||||
@@ -365,6 +365,12 @@ public class Xowd_page_tbl implements Db_tbl {
|
||||
.Exec_update()
|
||||
;
|
||||
}
|
||||
public void Delete(int page_id) {
|
||||
Gfo_usr_dlg_.Instance.Log_many("", "", "db.page: delete started: page_id=~{0}", page_id);
|
||||
Db_stmt stmt = conn.Stmt_delete(tbl_name, fld_id);
|
||||
stmt.Clear().Crt_int(fld_id, page_id).Exec_delete();
|
||||
Gfo_usr_dlg_.Instance.Log_many("", "", "db.page: delete done");
|
||||
}
|
||||
public void Create_idx() {
|
||||
conn.Meta_idx_create(Xoa_app_.Usr_dlg()
|
||||
, Dbmeta_idx_itm.new_normal_by_tbl(tbl_name, "title" , fld_title, fld_ns)
|
||||
|
||||
@@ -76,11 +76,13 @@ public class Xowd_site_ns_tbl implements Db_tbl {
|
||||
} finally {rdr.Rls();}
|
||||
}
|
||||
public void Update_ns_count(int ns_id, int ns_count) {
|
||||
Gfo_usr_dlg_.Instance.Log_many("", "", "db.site_ns: update started: ns_id=~{0} ns_count=~{1}", ns_id, ns_count);
|
||||
Db_stmt stmt = conn.Stmt_update(tbl_name, String_.Ary(fld_id), fld_count);
|
||||
stmt.Clear()
|
||||
.Val_int(fld_count, ns_count)
|
||||
.Crt_int(fld_id, ns_id)
|
||||
.Exec_update();
|
||||
Gfo_usr_dlg_.Instance.Log_many("", "", "db.site_ns: update done");
|
||||
}
|
||||
public void Rls() {}
|
||||
|
||||
|
||||
@@ -44,6 +44,11 @@ public class Xowd_text_tbl implements Db_tbl {
|
||||
text = zip_mgr.Zip(zip_tid, text);
|
||||
stmt.Clear().Val_bry(fld_text_data, text).Crt_int(fld_page_id, page_id).Exec_update();
|
||||
}
|
||||
public void Delete(int page_id) {
|
||||
Gfo_usr_dlg_.Instance.Log_many("", "", "db.text: delete started: db=~{0} page_id=~{1}", conn.Conn_info().Raw(), page_id);
|
||||
conn.Stmt_delete(tbl_name, fld_page_id).Crt_int(fld_page_id, page_id).Exec_delete();
|
||||
Gfo_usr_dlg_.Instance.Log_many("", "", "db.text: delete done");
|
||||
}
|
||||
public byte[] Select(int page_id) {
|
||||
synchronized (thread_lock) { // LOCK:stmt-rls; DATE:2016-07-06
|
||||
if (stmt_select == null) stmt_select = conn.Stmt_select(tbl_name, flds, fld_page_id);
|
||||
|
||||
Reference in New Issue
Block a user