mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
'v3.3.4.1'
This commit is contained in:
@@ -16,7 +16,7 @@ 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.core.srls; import gplx.*; import gplx.core.*;
|
||||
import gplx.dbs.metas.*;
|
||||
import gplx.dbs.*; import gplx.dbs.metas.*;
|
||||
public class Dbmeta_dat_mgr {
|
||||
private final Ordered_hash hash = Ordered_hash_.New();
|
||||
public Dbmeta_dat_mgr Clear() {hash.Clear(); return this;}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class DbMaprItm {
|
||||
contextFlds.Add(arg.ObjProp(), arg);
|
||||
return this;
|
||||
}
|
||||
public DbMaprItm ConstantFlds_add(String dbFld, Object dbVal) {constantFlds.Add(dbFld, KeyVal_.new_(dbFld, dbVal)); return this;}
|
||||
public DbMaprItm ConstantFlds_add(String dbFld, Object dbVal) {constantFlds.Add(dbFld, Keyval_.new_(dbFld, dbVal)); return this;}
|
||||
public DbMaprItm Subs_add(DbMaprItm... ary) {
|
||||
for (DbMaprItm itm : ary)
|
||||
subs.Add(itm);
|
||||
|
||||
@@ -44,16 +44,16 @@ public class DbMaprMgr_tst {
|
||||
} DbMaprMgr mgr; DbMaprWtr wtr; Db_conn conn; MockDisc disc; MockTitle title; MockChapter chapter; MockStream audio, subtitle; SrlMgr rdr;
|
||||
@Test public void PurgeObjTree() {
|
||||
disc = MockDisc.new_().Id_(1);
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_discs", KeyValList.args_("disc_id", 1));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_discs", Keyval_list.New_with_one("disc_id", 1));
|
||||
DbMaprWtrUtl.PurgeObjTree(disc, mgr, conn);
|
||||
Tfds.Eq(0, Db_qry_fxt.SelectAll_count(conn, "mock_discs"));
|
||||
}
|
||||
@Test public void PurgeObjTree_deep() {
|
||||
disc = MockDisc.new_().Id_(1);
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_discs", KeyValList.args_("disc_id", 1));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_titles", KeyValList.args_("disc_id", 1).Add("title_id", 1));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_chapters", KeyValList.args_("disc_id", 1).Add("title_id", 2).Add("chapter_id", 3));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_chapters", KeyValList.args_("disc_id", 2).Add("title_id", 2).Add("chapter_id", 3));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_discs", Keyval_list.New_with_one("disc_id", 1));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_titles", Keyval_list.New_with_one("disc_id", 1).Add("title_id", 1));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_chapters", Keyval_list.New_with_one("disc_id", 1).Add("title_id", 2).Add("chapter_id", 3));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_chapters", Keyval_list.New_with_one("disc_id", 2).Add("title_id", 2).Add("chapter_id", 3));
|
||||
DbMaprWtrUtl.PurgeObjTree(disc, mgr, conn);
|
||||
|
||||
Tfds.Eq(0, Db_qry_fxt.SelectAll_count(conn, "mock_discs"));
|
||||
@@ -92,7 +92,7 @@ public class DbMaprMgr_tst {
|
||||
}
|
||||
@Test public void Load_root() {
|
||||
rdr = rdr_();
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_discs", KeyValList.args_("disc_id", 1).Add("disc_name", "name"));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_discs", Keyval_list.New_with_one("disc_id", 1).Add("disc_name", "name"));
|
||||
disc = (MockDisc)rdr.StoreRoot(MockDisc.Instance, null);
|
||||
|
||||
Tfds.Eq(1, disc.Id());
|
||||
@@ -101,9 +101,9 @@ public class DbMaprMgr_tst {
|
||||
}
|
||||
@Test public void Load_subs() {
|
||||
rdr = rdr_();
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_discs", KeyValList.args_("disc_id", 1).Add("disc_name", "name"));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_titles", KeyValList.args_("disc_id", 1).Add("title_id", 1).Add("title_name", "title1"));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_titles", KeyValList.args_("disc_id", 1).Add("title_id", 2).Add("title_name", "title2"));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_discs", Keyval_list.New_with_one("disc_id", 1).Add("disc_name", "name"));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_titles", Keyval_list.New_with_one("disc_id", 1).Add("title_id", 1).Add("title_name", "title1"));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_titles", Keyval_list.New_with_one("disc_id", 1).Add("title_id", 2).Add("title_name", "title2"));
|
||||
disc = (MockDisc)rdr.StoreRoot(MockDisc.Instance, null);
|
||||
|
||||
Tfds.Eq(1, disc.Id());
|
||||
@@ -114,11 +114,11 @@ public class DbMaprMgr_tst {
|
||||
}
|
||||
@Test public void Load_deep() {
|
||||
rdr = rdr_();
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_discs", KeyValList.args_("disc_id", 1).Add("disc_name", "name"));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_titles", KeyValList.args_("disc_id", 1).Add("title_id", 1).Add("title_name", "title1"));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_chapters", KeyValList.args_("disc_id", 1).Add("title_id", 1).Add("chapter_id", 3).Add("chapter_name", "chapter1"));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_streams", KeyValList.args_("disc_id", 1).Add("title_id", 1).Add("stream_id", 4).Add("stream_type", 0).Add("stream_name", "audio1"));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_streams", KeyValList.args_("disc_id", 1).Add("title_id", 1).Add("stream_id", 5).Add("stream_type", 1).Add("stream_name", "subtitle1"));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_discs", Keyval_list.New_with_one("disc_id", 1).Add("disc_name", "name"));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_titles", Keyval_list.New_with_one("disc_id", 1).Add("title_id", 1).Add("title_name", "title1"));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_chapters", Keyval_list.New_with_one("disc_id", 1).Add("title_id", 1).Add("chapter_id", 3).Add("chapter_name", "chapter1"));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_streams", Keyval_list.New_with_one("disc_id", 1).Add("title_id", 1).Add("stream_id", 4).Add("stream_type", 0).Add("stream_name", "audio1"));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_streams", Keyval_list.New_with_one("disc_id", 1).Add("title_id", 1).Add("stream_id", 5).Add("stream_type", 1).Add("stream_name", "subtitle1"));
|
||||
disc = (MockDisc)rdr.StoreRoot(MockDisc.Instance, null);
|
||||
|
||||
Tfds.Eq(1, disc.Id());
|
||||
|
||||
@@ -50,7 +50,7 @@ public class DbMaprRdr extends DataRdr_base implements SrlMgr {
|
||||
Criteria rv = null, cur = null;
|
||||
List_adp list = GetIdxFlds(mgr, mapr);
|
||||
for (Object kvObj : list) {
|
||||
KeyVal kv = (KeyVal)kvObj;
|
||||
Keyval kv = (Keyval)kvObj;
|
||||
cur = Db_crt_.New_eq(kv.Key(), kv.Val());
|
||||
rv = (rv == null) ? cur : Criteria_.And(rv, cur);
|
||||
}
|
||||
@@ -65,11 +65,11 @@ public class DbMaprRdr extends DataRdr_base implements SrlMgr {
|
||||
for (Object argObj : mapr.ContextFlds()) {
|
||||
DbMaprArg arg = (DbMaprArg)argObj;
|
||||
Object propVal = GfoInvkAble_.InvkCmd((GfoInvkAble)gobj, arg.ObjProp());
|
||||
rv.Add(KeyVal_.new_(arg.DbFld(), propVal));
|
||||
rv.Add(Keyval_.new_(arg.DbFld(), propVal));
|
||||
}
|
||||
}
|
||||
for (Object argObj : curMapr.ConstantFlds()) {
|
||||
KeyVal arg = (KeyVal)argObj;
|
||||
Keyval arg = (Keyval)argObj;
|
||||
rv.Add(arg);
|
||||
}
|
||||
return rv;
|
||||
@@ -109,7 +109,7 @@ public class DbMaprRdr extends DataRdr_base implements SrlMgr {
|
||||
@Override public int FieldCount() {throw Err_.new_unimplemented();}
|
||||
@Override public String KeyAt(int i) {throw Err_.new_unimplemented();}
|
||||
@Override public Object ReadAt(int i) {throw Err_.new_unimplemented();}
|
||||
@Override public KeyVal KeyValAt(int i) {throw Err_.new_unimplemented();}
|
||||
@Override public Keyval KeyValAt(int i) {throw Err_.new_unimplemented();}
|
||||
@Override public SrlMgr SrlMgr_new(Object o) {return new DbMaprRdr();}
|
||||
Hash_adp tables = Hash_adp_.new_();
|
||||
Db_conn conn; Criteria rootCrt;
|
||||
|
||||
Reference in New Issue
Block a user