mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
'v3.7.3.1'
This commit is contained in:
@@ -54,12 +54,12 @@ public class Xowd_cat_link_tbl implements Rls_able {
|
||||
public int Select_by_type(List_adp list, int cat_page_id, byte arg_tid, byte[] arg_sortkey, boolean arg_is_from, int limit) {
|
||||
String arg_sortkey_str = arg_sortkey == null ? "" : String_.new_u8(arg_sortkey);
|
||||
gplx.core.criterias.Criteria comp_crt = !arg_is_from
|
||||
? Db_crt_.New_mte(fld_sortkey, arg_sortkey_str) // from: sortkey >= 'val'
|
||||
? Db_crt_.New_mte(fld_sortkey, arg_sortkey_str) // from: sortkey >= 'val'
|
||||
: Db_crt_.New_lte(fld_sortkey, arg_sortkey_str); // until: sortkey <= 'val'
|
||||
Db_qry__select_cmd qry = Db_qry_.select_().Cols_(fld_from, fld_sortkey).From_(tbl_name)
|
||||
.Where_(gplx.core.criterias.Criteria_.And_many(Db_crt_.New_eq(fld_to_id, -1), Db_crt_.New_eq(fld_type_id, arg_tid), comp_crt))
|
||||
.Order_(fld_sortkey, !arg_is_from)
|
||||
.Limit_(limit + 1); // + 1 to get last_plus_one for next page / previous page
|
||||
.Limit_(limit + 1); // + 1 to get last_plus_one for next page / previous page
|
||||
Db_rdr rdr = conn.Stmt_new(qry).Crt_int(fld_to_id, cat_page_id).Crt_byte(fld_type_id, arg_tid).Crt_str(fld_sortkey, arg_sortkey_str).Exec_select__rls_auto();
|
||||
int count = 0;
|
||||
try {
|
||||
|
||||
@@ -156,9 +156,8 @@ public class Xowd_page_tbl implements Rls_able {
|
||||
wkr.Init(this, ns_mgr, rv);
|
||||
wkr.Select_in(cancelable, conn, bgn, end);
|
||||
}
|
||||
public boolean Select_in__id(Cancelable cancelable, List_adp rv) {return Select_in__id(cancelable, false, rv, 0, rv.Count());}
|
||||
public boolean Select_in__id(Cancelable cancelable, boolean skip_table_read, List_adp rv) {return Select_in__id(cancelable, skip_table_read, rv, 0, rv.Count());}
|
||||
public boolean Select_in__id(Cancelable cancelable, boolean skip_table_read, List_adp rv, int bgn, int end) {
|
||||
public boolean Select_in__id(Cancelable cancelable, boolean show_progress, List_adp rv) {return Select_in__id(cancelable, false, show_progress, rv, 0, rv.Count());}
|
||||
public boolean Select_in__id(Cancelable cancelable, boolean skip_table_read, boolean show_progress, List_adp rv, int bgn, int end) {
|
||||
Xowd_page_itm[] page_ary = (Xowd_page_itm[])rv.To_ary(Xowd_page_itm.class);
|
||||
int len = page_ary.length; if (len == 0) return false;
|
||||
Ordered_hash hash = Ordered_hash_.New();
|
||||
@@ -169,13 +168,9 @@ public class Xowd_page_tbl implements Rls_able {
|
||||
hash.Add(p.Id_val(), p);
|
||||
}
|
||||
hash.Sort_by(Xowd_page_itm_sorter.IdAsc); // sort by ID to reduce disk thrashing; DATE:2015-03-31
|
||||
conn.Txn_bgn("schema__page__select_in");
|
||||
try {
|
||||
Xowd_page_tbl__id wkr = new Xowd_page_tbl__id();
|
||||
wkr.Ctor(this, tbl_name, fld_id);
|
||||
wkr.Init(rv, hash);
|
||||
wkr.Select_in(cancelable, conn, bgn, end);
|
||||
} finally {conn.Txn_end();}
|
||||
Xowd_page_tbl__id wkr = new Xowd_page_tbl__id(rv, hash, show_progress);
|
||||
wkr.Ctor(this, tbl_name, fld_id);
|
||||
wkr.Select_in(cancelable, conn, bgn, end);
|
||||
return true;
|
||||
}
|
||||
public byte[] Select_random(Xow_ns ns) {// ns should be ns_main
|
||||
|
||||
@@ -19,10 +19,14 @@ package gplx.xowa.wikis.data.tbls; import gplx.*; import gplx.xowa.*; import gpl
|
||||
import gplx.core.criterias.*;
|
||||
import gplx.dbs.*; import gplx.dbs.utls.*;
|
||||
class Xowd_page_tbl__id extends Xowd_page_tbl__in_wkr__base {
|
||||
private List_adp list; // list is original list of ids which may have dupes; needed to fill statement (which takes range of bgn - end); DATE:2013-12-08
|
||||
private Ordered_hash hash; // hash is unique list of ids; needed for fetch from rdr (which indexes by id)
|
||||
public void Init(List_adp list, Ordered_hash hash) {this.list = list; this.hash = hash; this.Fill_idx_fields_only_(true);}
|
||||
@Override protected boolean Show_progress() {return true;}
|
||||
private final List_adp list; // list is original list of ids which may have dupes; needed to fill statement (which takes range of bgn - end); DATE:2013-12-08
|
||||
private final Ordered_hash hash; // hash is unique list of ids; needed for fetch from rdr (which indexes by id)
|
||||
public Xowd_page_tbl__id(List_adp list, Ordered_hash hash, boolean show_progress) {
|
||||
this.show_progress = show_progress;
|
||||
this.list = list; this.hash = hash;
|
||||
this.Fill_idx_fields_only_(true);
|
||||
}
|
||||
@Override protected boolean Show_progress() {return show_progress;} private final boolean show_progress;
|
||||
@Override protected Criteria In_filter(Object[] part_ary) {
|
||||
return Db_crt_.New_in(this.In_fld_name(), part_ary);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
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.wikis.data.tbls; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.data.*;
|
||||
public interface Xowd_text_bry_owner {
|
||||
int Page_id();
|
||||
void Set_text_bry_by_db(byte[] v);
|
||||
}
|
||||
Reference in New Issue
Block a user