mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
Refactor: Pull more classes into baselib
This commit is contained in:
@@ -13,7 +13,9 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.core.stores; import gplx.*;
|
||||
package gplx.core.stores;
|
||||
import gplx.frameworks.tests.GfoTstr;
|
||||
import gplx.types.commons.KeyValList;
|
||||
import org.junit.*;
|
||||
import gplx.dbs.*; /*Db_conn_info*/
|
||||
public class DbMaprMgr_tst {
|
||||
@@ -42,21 +44,21 @@ 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", Keyval_list.New_with_one("disc_id", 1));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_discs", KeyValList.NewWithOne("disc_id", 1));
|
||||
DbMaprWtrUtl.PurgeObjTree(disc, mgr, conn);
|
||||
Tfds.Eq(0, Db_qry_fxt.SelectAll_count(conn, "mock_discs"));
|
||||
GfoTstr.EqObj(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", 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));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_discs", KeyValList.NewWithOne("disc_id", 1));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_titles", KeyValList.NewWithOne("disc_id", 1).Add("title_id", 1));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_chapters", KeyValList.NewWithOne("disc_id", 1).Add("title_id", 2).Add("chapter_id", 3));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_chapters", KeyValList.NewWithOne("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"));
|
||||
Tfds.Eq(0, Db_qry_fxt.SelectAll_count(conn, "mock_titles"));
|
||||
Tfds.Eq(1, Db_qry_fxt.SelectAll_count(conn, "mock_chapters")); // ignore chapter with disc_id=2
|
||||
GfoTstr.EqObj(0, Db_qry_fxt.SelectAll_count(conn, "mock_discs"));
|
||||
GfoTstr.EqObj(0, Db_qry_fxt.SelectAll_count(conn, "mock_titles"));
|
||||
GfoTstr.EqObj(1, Db_qry_fxt.SelectAll_count(conn, "mock_chapters")); // ignore chapter with disc_id=2
|
||||
}
|
||||
@Test public void Save_root() {
|
||||
disc = MockDisc.new_().Id_(1).Name_("disc");
|
||||
@@ -90,45 +92,45 @@ public class DbMaprMgr_tst {
|
||||
}
|
||||
@Test public void Load_root() {
|
||||
rdr = rdr_();
|
||||
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_discs", KeyValList.NewWithOne("disc_id", 1).Add("disc_name", "name"));
|
||||
disc = (MockDisc)rdr.StoreRoot(MockDisc.Instance, null);
|
||||
|
||||
Tfds.Eq(1, disc.Id());
|
||||
Tfds.Eq("name", disc.Name());
|
||||
Tfds.Eq(0, disc.Titles().Len());
|
||||
GfoTstr.EqObj(1, disc.Id());
|
||||
GfoTstr.EqObj("name", disc.Name());
|
||||
GfoTstr.EqObj(0, disc.Titles().Len());
|
||||
}
|
||||
@Test public void Load_subs() {
|
||||
rdr = rdr_();
|
||||
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"));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_discs", KeyValList.NewWithOne("disc_id", 1).Add("disc_name", "name"));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_titles", KeyValList.NewWithOne("disc_id", 1).Add("title_id", 1).Add("title_name", "title1"));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_titles", KeyValList.NewWithOne("disc_id", 1).Add("title_id", 2).Add("title_name", "title2"));
|
||||
disc = (MockDisc)rdr.StoreRoot(MockDisc.Instance, null);
|
||||
|
||||
Tfds.Eq(1, disc.Id());
|
||||
Tfds.Eq("name", disc.Name());
|
||||
Tfds.Eq(2, disc.Titles().Len());
|
||||
Tfds.Eq("title1", ((MockTitle)disc.Titles().Get_at(0)).Name());
|
||||
Tfds.Eq("title2", ((MockTitle)disc.Titles().Get_at(1)).Name());
|
||||
GfoTstr.EqObj(1, disc.Id());
|
||||
GfoTstr.EqObj("name", disc.Name());
|
||||
GfoTstr.EqObj(2, disc.Titles().Len());
|
||||
GfoTstr.EqObj("title1", ((MockTitle)disc.Titles().GetAt(0)).Name());
|
||||
GfoTstr.EqObj("title2", ((MockTitle)disc.Titles().GetAt(1)).Name());
|
||||
}
|
||||
@Test public void Load_deep() {
|
||||
rdr = rdr_();
|
||||
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"));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_discs", KeyValList.NewWithOne("disc_id", 1).Add("disc_name", "name"));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_titles", KeyValList.NewWithOne("disc_id", 1).Add("title_id", 1).Add("title_name", "title1"));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_chapters", KeyValList.NewWithOne("disc_id", 1).Add("title_id", 1).Add("chapter_id", 3).Add("chapter_name", "chapter1"));
|
||||
Db_qry_fxt.Insert_kvo(conn, "mock_streams", KeyValList.NewWithOne("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.NewWithOne("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());
|
||||
Tfds.Eq("name", disc.Name());
|
||||
Tfds.Eq(1, disc.Titles().Len());
|
||||
MockTitle t = ((MockTitle)disc.Titles().Get_at(0));
|
||||
Tfds.Eq("title1", t.Name());
|
||||
Tfds.Eq("chapter1", ((MockChapter)t.Chapters().Get_at(0)).Name());
|
||||
Tfds.Eq(1, t.Audios().Len());
|
||||
Tfds.Eq(1, t.Subtitles().Len());
|
||||
Tfds.Eq("audio1", ((MockStream)t.Audios().Get_at(0)).Name());
|
||||
Tfds.Eq("subtitle1", ((MockStream)t.Subtitles().Get_at(0)).Name());
|
||||
GfoTstr.EqObj(1, disc.Id());
|
||||
GfoTstr.EqObj("name", disc.Name());
|
||||
GfoTstr.EqObj(1, disc.Titles().Len());
|
||||
MockTitle t = ((MockTitle)disc.Titles().GetAt(0));
|
||||
GfoTstr.EqObj("title1", t.Name());
|
||||
GfoTstr.EqObj("chapter1", ((MockChapter)t.Chapters().GetAt(0)).Name());
|
||||
GfoTstr.EqObj(1, t.Audios().Len());
|
||||
GfoTstr.EqObj(1, t.Subtitles().Len());
|
||||
GfoTstr.EqObj("audio1", ((MockStream)t.Audios().GetAt(0)).Name());
|
||||
GfoTstr.EqObj("subtitle1", ((MockStream)t.Subtitles().GetAt(0)).Name());
|
||||
}
|
||||
DbMaprRdr rdr_() {
|
||||
DbMaprRdr rv = DbMaprRdr.new_(Db_conn_info_.Test, Db_crt_.New_eq("disc_id", 1));
|
||||
|
||||
@@ -13,19 +13,23 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.dbs; import gplx.*;
|
||||
package gplx.dbs;
|
||||
import gplx.core.gfo_ndes.*;
|
||||
import gplx.frameworks.tests.GfoTstr;
|
||||
import gplx.types.basics.lists.List_adp;
|
||||
import gplx.types.basics.lists.List_adp_;
|
||||
import gplx.types.basics.utls.ObjectUtl;
|
||||
public class GfoNdeTstr {
|
||||
public static void tst_ValsByCol(GfoNde nde, String fld, Object... expdAry) {
|
||||
List_adp expd = List_adp_.New();
|
||||
for (int i = 0; i < expdAry.length; i++) {
|
||||
expd.Add(Object_.Xto_str_strict_or_empty(expdAry[i]));
|
||||
expd.Add(ObjectUtl.ToStrOrEmpty(expdAry[i]));
|
||||
}
|
||||
List_adp actl = List_adp_.New();
|
||||
for (int i = 0; i < nde.Subs().Count(); i++) {
|
||||
GfoNde sub = nde.Subs().FetchAt_asGfoNde(i);
|
||||
actl.Add(Object_.Xto_str_strict_or_empty(sub.Read(fld)));
|
||||
actl.Add(ObjectUtl.ToStrOrEmpty(sub.Read(fld)));
|
||||
}
|
||||
Tfds.Eq_ary(expd.ToStrAry(), actl.ToStrAry());
|
||||
GfoTstr.EqLines(expd.ToStrAry(), actl.ToStrAry());
|
||||
}
|
||||
}
|
||||
@@ -13,20 +13,23 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.dbs.engines; import gplx.*; import gplx.dbs.*;
|
||||
package gplx.dbs.engines; import gplx.dbs.*;
|
||||
import gplx.frameworks.tests.GfoDbTstr;
|
||||
import gplx.frameworks.tests.GfoTstr;
|
||||
import gplx.types.commons.KeyVal;
|
||||
import org.junit.*; import gplx.dbs.qrys.*;
|
||||
public class db_CrudOps_tst {
|
||||
CrudOpsFxt fx = new CrudOpsFxt();
|
||||
@Test public void Mysql() {if (Tfds.SkipDb) return;
|
||||
@Test public void Mysql() {if (GfoDbTstr.SkipDb) return;
|
||||
fx.RunAll(Db_conn_fxt.Mysql());
|
||||
}
|
||||
@Test public void Tdb() {if (Tfds.SkipDb) return;
|
||||
@Test public void Tdb() {if (GfoDbTstr.SkipDb) return;
|
||||
fx.RunAll(Db_conn_fxt.Tdb("100_dbs_crud_ops.dsv"));
|
||||
}
|
||||
@Test public void Postgres() {if (Db_conn_fxt.SkipPostgres) return;
|
||||
fx.RunAll(Db_conn_fxt.Postgres());
|
||||
}
|
||||
@Test public void Sqlite() {if (Tfds.SkipDb) return;
|
||||
@Test public void Sqlite() {if (GfoDbTstr.SkipDb) return;
|
||||
fx.Fx().DmlAffectedAvailable_(false);
|
||||
fx.RunAll(Db_conn_fxt.Sqlite());
|
||||
}
|
||||
@@ -58,7 +61,7 @@ class CrudOpsFxt {
|
||||
fx.tst_ExecDml(1, Db_qry_.insert_("dbs_crud_ops").Val_int("id", 1).Val_str("name", "John Doe"));
|
||||
fx.tst_ExecDml(1, Db_qry_.insert_("dbs_crud_ops").Val_int("id", 2).Val_str("name", "John Doe"));
|
||||
|
||||
fx.tst_ExecDml(1, Db_qry_.update_common_("dbs_crud_ops", Db_crt_.New_eq("id", 2), Keyval_.new_("name", "Jane Smith")));
|
||||
fx.tst_ExecDml(1, Db_qry_.update_common_("dbs_crud_ops", Db_crt_.New_eq("id", 2), KeyVal.NewStr("name", "Jane Smith")));
|
||||
fx.tst_ExecRdrTbl(2, "dbs_crud_ops");
|
||||
fx.tst_RowAry(0, 1, "John Doe");
|
||||
fx.tst_RowAry(1, 2, "Jane Smith");
|
||||
@@ -68,7 +71,7 @@ class CrudOpsFxt {
|
||||
fx.tst_ExecDml(1, Db_qry_.insert_("dbs_crud_ops").Val_int("id", 1).Val_str("name", "John Doe"));
|
||||
fx.tst_ExecDml(1, Db_qry_.insert_("dbs_crud_ops").Val_int("id", 2).Val_str("name", "John Doe"));
|
||||
|
||||
fx.tst_ExecDml(2, Db_qry_.update_common_("dbs_crud_ops", Db_crt_.New_eq("name", "John Doe"), Keyval_.new_("name", "Jane Smith")));
|
||||
fx.tst_ExecDml(2, Db_qry_.update_common_("dbs_crud_ops", Db_crt_.New_eq("name", "John Doe"), KeyVal.NewStr("name", "Jane Smith")));
|
||||
fx.tst_ExecRdrTbl(2, "dbs_crud_ops");
|
||||
fx.tst_RowAry(0, 1, "Jane Smith");
|
||||
fx.tst_RowAry(1, 2, "Jane Smith");
|
||||
@@ -111,17 +114,17 @@ class CrudOpsFxt {
|
||||
String val = "Ω";
|
||||
fx.tst_ExecDml(1, Db_qry_.insert_("dbs_crud_ops").Val_int("id", 3).Val_obj_type("name", val, Db_val_type.Tid_nvarchar));
|
||||
Db_qry__select_cmd select = Db_qry_.select_val_("dbs_crud_ops", "name", Db_crt_.New_eq("id", 3));
|
||||
Tfds.Eq(val, ExecRdr_val(select));
|
||||
GfoTstr.EqObj(val, ExecRdr_val(select));
|
||||
|
||||
fx.tst_ExecDml(1, Db_qry_.update_("dbs_crud_ops", Db_crt_.Wildcard).Val_obj_type("name", val + "a", Db_val_type.Tid_nvarchar));
|
||||
Tfds.Eq(val + "a", ExecRdr_val(select));
|
||||
GfoTstr.EqObj(val + "a", ExecRdr_val(select));
|
||||
}
|
||||
public void Backslash_hook() {
|
||||
this.Init();
|
||||
String val = "\\";
|
||||
fx.tst_ExecDml(1, Db_qry_.insert_("dbs_crud_ops").Val_int("id", 3).Val_str("name", val));
|
||||
Tfds.Eq(val, ExecRdr_val(Db_qry_.select_val_("dbs_crud_ops", "name", Db_crt_.New_eq("id", 3))));
|
||||
Tfds.Eq(val, ExecRdr_val(Db_qry_.select_val_("dbs_crud_ops", "name", Db_crt_.New_eq("name", "\\"))));
|
||||
GfoTstr.EqObj(val, ExecRdr_val(Db_qry_.select_val_("dbs_crud_ops", "name", Db_crt_.New_eq("id", 3))));
|
||||
GfoTstr.EqObj(val, ExecRdr_val(Db_qry_.select_val_("dbs_crud_ops", "name", Db_crt_.New_eq("name", "\\"))));
|
||||
}
|
||||
String ExecRdr_val(Db_qry__select_cmd select) {return (String)Db_qry_.Exec_as_obj(fx.Conn(), select);}
|
||||
}
|
||||
|
||||
@@ -13,23 +13,29 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.dbs.engines; import gplx.*; import gplx.dbs.*;
|
||||
package gplx.dbs.engines; import gplx.dbs.*;
|
||||
import gplx.frameworks.tests.GfoDbTstr;
|
||||
import gplx.frameworks.tests.GfoTstr;
|
||||
import gplx.types.basics.utls.ObjectUtl;
|
||||
import gplx.types.basics.utls.FloatUtl;
|
||||
import gplx.types.commons.GfoDateUtl;
|
||||
import gplx.types.commons.GfoDecimalUtl;
|
||||
import org.junit.*; import gplx.core.type_xtns.*; import gplx.core.stores.*;
|
||||
public class db_DataTypes_tst {
|
||||
DataTypes_base_fxt fx = new DataTypes_base_fxt();
|
||||
@Test public void Mysql() {if (Tfds.SkipDb) return;
|
||||
@Test public void Mysql() {if (GfoDbTstr.SkipDb) return;
|
||||
fx.Select_FloatStr_("0.333333");
|
||||
fx.RunAll(Db_conn_fxt.Mysql());
|
||||
}
|
||||
@Test public void Tdb() {if (Tfds.SkipDb) return;
|
||||
fx.Select_FloatStr_(Float_.To_str(Float_.Div(1, 3)));
|
||||
@Test public void Tdb() {if (GfoDbTstr.SkipDb) return;
|
||||
fx.Select_FloatStr_(FloatUtl.ToStr(FloatUtl.Div(1, 3)));
|
||||
fx.RunAll(Db_conn_fxt.Tdb("110_dbs_multiple_data_types.dsv"));
|
||||
}
|
||||
@Test public void Postgres() {if (Db_conn_fxt.SkipPostgres) return;
|
||||
fx.Select_FloatStr_("0.33333334");
|
||||
fx.RunAll(Db_conn_fxt.Postgres());
|
||||
}
|
||||
@Test public void Sqlite() {if (Tfds.SkipDb) return;
|
||||
@Test public void Sqlite() {if (GfoDbTstr.SkipDb) return;
|
||||
fx.Select_FloatStr_("0.33333334");
|
||||
fx.RunAll(Db_conn_fxt.Sqlite());
|
||||
}
|
||||
@@ -60,18 +66,18 @@ class DataTypes_base_fxt {
|
||||
DataRdr rdr = conn.Exec_qry_as_old_rdr(Db_qry_.select_tbl_("dbs_multiple_data_types"));
|
||||
|
||||
rdr.MoveNextPeer();
|
||||
Tfds.Eq(rdr.ReadInt("unique_id"), 1);
|
||||
Tfds.Eq(rdr.ReadStr("full_name"), "John Doe");
|
||||
Tfds.Eq(rdr.ReadBool("is_active"), true);
|
||||
Tfds.Eq_date(rdr.ReadDate("last_update"), DateAdp_.parse_gplx("2006-03-30 22:22:00.000"));
|
||||
Tfds.Eq(floatStr, Object_.Xto_str_strict_or_empty(rdr.ReadFloat("quantity")));
|
||||
Tfds.Eq_decimal(rdr.ReadDecimal("amount"), Decimal_adp_.parts_(12, 345));
|
||||
GfoTstr.EqObj(rdr.ReadInt("unique_id"), 1);
|
||||
GfoTstr.EqObj(rdr.ReadStr("full_name"), "John Doe");
|
||||
GfoTstr.EqObj(rdr.ReadBool("is_active"), true);
|
||||
GfoTstr.Eq(rdr.ReadDate("last_update"), GfoDateUtl.ParseGplx("2006-03-30 22:22:00.000"));
|
||||
GfoTstr.EqObj(floatStr, ObjectUtl.ToStrOrEmpty(rdr.ReadFloat("quantity")));
|
||||
GfoTstr.Eq(rdr.ReadDecimal("amount"), GfoDecimalUtl.NewByParts(12, 345));
|
||||
}
|
||||
public void UpdateDate_hook() {
|
||||
conn.Exec_qry(Db_qry_.update_("dbs_multiple_data_types", Db_crt_.New_eq("unique_id", 1)).Val_obj("last_update", DateAdpClassXtn.Instance.XtoDb(DateAdp_.parse_gplx("20091115 220000.000"))));
|
||||
conn.Exec_qry(Db_qry_.update_("dbs_multiple_data_types", Db_crt_.New_eq("unique_id", 1)).Val_obj("last_update", DateAdpClassXtn.Instance.XtoDb(GfoDateUtl.ParseGplx("20091115 220000.000"))));
|
||||
|
||||
DataRdr rdr = conn.Exec_qry_as_old_rdr(Db_qry_.select_tbl_("dbs_multiple_data_types"));
|
||||
rdr.MoveNextPeer();
|
||||
Tfds.Eq_date(rdr.ReadDate("last_update"), DateAdp_.parse_gplx("20091115 220000.000"));
|
||||
GfoTstr.Eq(rdr.ReadDate("last_update"), GfoDateUtl.ParseGplx("20091115 220000.000"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.dbs.joins; import gplx.*; import gplx.dbs.*;
|
||||
import org.junit.*; import gplx.core.gfo_ndes.*; import gplx.dbs.qrys.*; import gplx.dbs.sqls.*; import gplx.core.stores.*;
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.dbs.joins; import gplx.dbs.*;
|
||||
import gplx.frameworks.tests.GfoTstr;
|
||||
import org.junit.*; import gplx.core.gfo_ndes.*; import gplx.dbs.qrys.*;
|
||||
import gplx.core.stores.*;
|
||||
public abstract class Joins_base_tst {
|
||||
protected Db_conn conn;
|
||||
@Before public void setup() {
|
||||
@@ -34,9 +36,9 @@ public abstract class Joins_base_tst {
|
||||
|
||||
DataRdr rdr = conn.Exec_qry_as_old_rdr(select);
|
||||
GfoNde table = GfoNde_.rdr_(rdr);
|
||||
Tfds.Eq(table.Subs().Count(), 2);
|
||||
Tfds.Eq(table.Subs().FetchAt_asGfoNde(0).Read("join_data"), "data0");
|
||||
Tfds.Eq(table.Subs().FetchAt_asGfoNde(1).Read("join_data"), "data1");
|
||||
GfoTstr.EqObj(table.Subs().Count(), 2);
|
||||
GfoTstr.EqObj(table.Subs().FetchAt_asGfoNde(0).Read("join_data"), "data0");
|
||||
GfoTstr.EqObj(table.Subs().FetchAt_asGfoNde(1).Read("join_data"), "data1");
|
||||
}
|
||||
protected abstract Db_conn provider_();
|
||||
}
|
||||
|
||||
@@ -13,7 +13,10 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.dbs.joins; import gplx.*; import gplx.dbs.*;
|
||||
package gplx.dbs.joins; import gplx.dbs.*;
|
||||
import gplx.frameworks.tests.GfoTstr;
|
||||
import gplx.types.errs.ErrUtl;
|
||||
import gplx.types.basics.utls.StringUtl;
|
||||
import org.junit.*;
|
||||
public class Joins_tdb_tst extends Joins_base_tst {
|
||||
@Override protected Db_conn provider_() {return Db_conn_fxt.Tdb("120_dbs_joins.dsv");}
|
||||
@@ -22,8 +25,8 @@ public class Joins_tdb_tst extends Joins_base_tst {
|
||||
InnerJoin_hook();
|
||||
}
|
||||
catch (Exception exc) {
|
||||
if (String_.Has(Err_.Message_lang(exc), "joins not supported for tdbs")) return;
|
||||
if (StringUtl.Has(ErrUtl.Message(exc), "joins not supported for tdbs")) return;
|
||||
}
|
||||
Tfds.Fail("'joins not supported for tdbs' error not thrown");
|
||||
GfoTstr.Fail("'joins not supported for tdbs' error not thrown");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package gplx.dbs.qrys;
|
||||
|
||||
import gplx.Byte_;
|
||||
import gplx.DateAdp_;
|
||||
import gplx.Decimal_adp_;
|
||||
import gplx.core.tests.Gftest;
|
||||
import gplx.objects.lists.GfoListBase;
|
||||
import gplx.frameworks.tests.GfoTstr;
|
||||
import gplx.types.basics.utls.ByteUtl;
|
||||
import gplx.types.commons.GfoDateUtl;
|
||||
import gplx.types.commons.GfoDecimalUtl;
|
||||
import gplx.types.commons.lists.GfoListBase;
|
||||
import org.junit.Test;
|
||||
|
||||
public class Db_val_typeTest {
|
||||
@@ -12,18 +12,18 @@ public class Db_val_typeTest {
|
||||
TestToSqlStr
|
||||
("ABC true 1 2 3 4.0 5 6 XYZ"
|
||||
,"ABC ? ? ? ? ? ? ? XYZ"
|
||||
, true, Byte_.By_int(1), 2, (long)3, (float)4, (double)5, Decimal_adp_.int_(6)
|
||||
, true, ByteUtl.ByInt(1), 2, (long)3, (float)4, (double)5, GfoDecimalUtl.NewByInt(6)
|
||||
);
|
||||
}
|
||||
@Test public void Strings() {
|
||||
TestToSqlStr
|
||||
("ABC 'abc' 'a\\'\"c' 'xyz' 'x\\'\"z' '2021-01-02 03:04:05.006' XYZ"
|
||||
,"ABC ? ? ? ? ? XYZ"
|
||||
, "abc", "a'\"c", "xyz", "x'\"z", DateAdp_.new_(2021, 1, 2, 3, 4, 5, 6)
|
||||
, "abc", "a'\"c", "xyz", "x'\"z", GfoDateUtl.New(2021, 1, 2, 3, 4, 5, 6)
|
||||
);
|
||||
}
|
||||
private void TestToSqlStr(String expd, String sql, Object... paramArray) {
|
||||
String actl = Db_val_type.ToSqlStr(sql, new GfoListBase<>().AddMany(paramArray));
|
||||
Gftest.Eq__str(expd, actl);
|
||||
GfoTstr.Eq(expd, actl);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,29 +14,28 @@ GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.dbs.sqls.wtrs;
|
||||
import gplx.Bry_bfr;
|
||||
import gplx.Bry_bfr_;
|
||||
import gplx.String_;
|
||||
import gplx.Tfds;
|
||||
import gplx.types.custom.brys.wtrs.BryWtr;
|
||||
import gplx.frameworks.tests.GfoTstr;
|
||||
import gplx.types.basics.utls.StringUtl;
|
||||
import gplx.core.criterias.Criteria;
|
||||
import gplx.dbs.Db_qry;
|
||||
import gplx.dbs.sqls.SqlQryWtr;
|
||||
import gplx.dbs.sqls.SqlQryWtrUtl;
|
||||
import gplx.objects.primitives.BoolUtl;
|
||||
import gplx.types.basics.utls.BoolUtl;
|
||||
class Sql_core_wtr_fxt {
|
||||
private final Sql_core_wtr__sqlite wtr = new Sql_core_wtr__sqlite();
|
||||
private final Sql_wtr_ctx ctx = new Sql_wtr_ctx(false);
|
||||
private final Bry_bfr bfr = Bry_bfr_.New();
|
||||
private final BryWtr bfr = BryWtr.New();
|
||||
public Sql_core_wtr_fxt Sql_wtr_(SqlQryWtr v) {sql_wtr = v; return this;} private SqlQryWtr sql_wtr = SqlQryWtrUtl.NewSqlite();
|
||||
public void Test__val(Object val, String expd) {
|
||||
wtr.Val_wtr().Bld_val(bfr, ctx, val);
|
||||
Tfds.Eq_str(expd, bfr.To_str_and_clear());
|
||||
GfoTstr.Eq(expd, bfr.ToStrAndClear());
|
||||
}
|
||||
public void Test__where(Criteria crt, String... expd) {
|
||||
wtr.Where_wtr().Bld_where_elem(bfr, ctx, crt);
|
||||
Tfds.Eq_str_lines(String_.Concat_lines_nl_skip_last(expd), bfr.To_str_and_clear());
|
||||
GfoTstr.EqLines(StringUtl.ConcatLinesNlSkipLast(expd), bfr.ToStrAndClear());
|
||||
}
|
||||
public void Test__qry(Db_qry qry, String expd) {
|
||||
Tfds.Eq_str_lines(expd, sql_wtr.ToSqlStr(qry, BoolUtl.N));
|
||||
GfoTstr.EqLines(expd, sql_wtr.ToSqlStr(qry, BoolUtl.N));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,13 +17,13 @@ package gplx.dbs.sqls.wtrs; import gplx.*; import gplx.dbs.*; import gplx.dbs.sq
|
||||
import org.junit.*;
|
||||
public class Sql_from_wtr_tst {
|
||||
private final Sql_core_wtr_fxt fxt = new Sql_core_wtr_fxt();
|
||||
@Test public void Abrv() {
|
||||
@Test public void Abrv() {
|
||||
fxt.Test__qry(Db_qry_.select_().Cols_all_().From_("tbl", "t"), "SELECT * FROM tbl t");
|
||||
}
|
||||
@Test public void Db() {
|
||||
@Test public void Db() {
|
||||
fxt.Test__qry(Db_qry_.select_().Cols_all_().From_("db", "tbl", "t"), "SELECT * FROM db.tbl t");
|
||||
}
|
||||
@Test public void Join() {
|
||||
@Test public void Join() {
|
||||
fxt.Test__qry
|
||||
( Db_qry_.select_().Cols_all_().From_("src", "s").Join_("trg", "t", Db_qry_.New_join__join("trg_id", "s", "src_id"))
|
||||
, "SELECT * FROM src s INNER JOIN trg t ON s.src_id = t.trg_id");
|
||||
|
||||
@@ -13,7 +13,8 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.dbs.sqls.wtrs; import gplx.*; import gplx.dbs.*; import gplx.dbs.sqls.*;
|
||||
package gplx.dbs.sqls.wtrs; import gplx.dbs.*; import gplx.dbs.sqls.*;
|
||||
import gplx.frameworks.tests.GfoTstr;
|
||||
import org.junit.*;
|
||||
import gplx.core.criterias.*;
|
||||
public class Sql_qry_wtr__ansi__tst {
|
||||
@@ -93,5 +94,5 @@ public class Sql_qry_wtr__ansi__tst {
|
||||
);
|
||||
}
|
||||
void tst_XtoSql(Db_qry cmd, String expd) {tst_XtoSql(cmd, expd, false);}
|
||||
void tst_XtoSql(Db_qry cmd, String expd, boolean prepare) {Tfds.Eq(expd, sqlWtr.ToSqlStr(cmd, prepare));}
|
||||
void tst_XtoSql(Db_qry cmd, String expd, boolean prepare) {GfoTstr.EqObj(expd, sqlWtr.ToSqlStr(cmd, prepare));}
|
||||
}
|
||||
|
||||
@@ -13,8 +13,10 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.dbs.sqls.wtrs; import gplx.*;
|
||||
package gplx.dbs.sqls.wtrs;
|
||||
import gplx.dbs.sqls.*;
|
||||
import gplx.types.custom.brys.wtrs.BryWtr;
|
||||
import gplx.frameworks.tests.GfoTstr;
|
||||
import org.junit.*;
|
||||
import gplx.core.criterias.*; /*Criteria_base*/
|
||||
import gplx.core.ios.*;
|
||||
@@ -53,8 +55,8 @@ public class Sql_qry_wtr__iosql__tst {
|
||||
private final Sql_wtr_ctx ctx = new Sql_wtr_ctx(false);
|
||||
void tst_Write(String expd, Criteria crt) {
|
||||
Sql_where_wtr where_wtr = ((Sql_core_wtr)SqlQryWtrUtl.NewBasic()).Where_wtr();
|
||||
Bry_bfr bfr = Bry_bfr_.New();
|
||||
BryWtr bfr = BryWtr.New();
|
||||
where_wtr.Bld_where_elem(bfr, ctx, crt);
|
||||
Tfds.Eq(expd, bfr.To_str_and_clear());
|
||||
GfoTstr.EqObj(expd, bfr.ToStrAndClear());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,9 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.dbs.sqls.wtrs; import gplx.*; import gplx.dbs.*; import gplx.dbs.sqls.*;
|
||||
package gplx.dbs.sqls.wtrs; import gplx.dbs.*; import gplx.dbs.sqls.*;
|
||||
import gplx.frameworks.tests.GfoTstr;
|
||||
import gplx.types.basics.utls.StringUtl;
|
||||
import org.junit.*;
|
||||
public class Sql_schema_wtr_tst {
|
||||
@Before public void setup() {} private final Sql_schema_wtr_fxt fxt = new Sql_schema_wtr_fxt();
|
||||
@@ -35,7 +37,7 @@ public class Sql_schema_wtr_tst {
|
||||
flds.AddText("fld_text");
|
||||
flds.AddBry("fld_bry");
|
||||
fxt.Test_create_tbl(Dbmeta_tbl_itm.New("tbl_name", flds.ToFldAry())
|
||||
, String_.Concat_lines_nl_skip_last
|
||||
, StringUtl.ConcatLinesNlSkipLast
|
||||
( "CREATE TABLE IF NOT EXISTS tbl_name"
|
||||
, "( fld_int_pkey integer NOT NULL PRIMARY KEY"
|
||||
, ", fld_bool boolean NOT NULL"
|
||||
@@ -60,7 +62,7 @@ public class Sql_schema_wtr_tst {
|
||||
}
|
||||
class Sql_schema_wtr_fxt {
|
||||
private Sql_schema_wtr sqlbldr = SqlQryWtrUtl.NewSqlite().Schema_wtr();
|
||||
public void Test_create_idx(Dbmeta_idx_itm idx, String expd) {Tfds.Eq(expd, sqlbldr.Bld_create_idx(idx));}
|
||||
public void Test_create_tbl(Dbmeta_tbl_itm tbl, String expd) {Tfds.Eq_str_lines(expd, sqlbldr.Bld_create_tbl(tbl));}
|
||||
public void Test_alter_tbl_add(String tbl, DbmetaFldItm fld, String expd) {Tfds.Eq_str_lines(expd, sqlbldr.Bld_alter_tbl_add(tbl, fld));}
|
||||
public void Test_create_idx(Dbmeta_idx_itm idx, String expd) {GfoTstr.EqObj(expd, sqlbldr.Bld_create_idx(idx));}
|
||||
public void Test_create_tbl(Dbmeta_tbl_itm tbl, String expd) {GfoTstr.EqLines(expd, sqlbldr.Bld_create_tbl(tbl));}
|
||||
public void Test_alter_tbl_add(String tbl, DbmetaFldItm fld, String expd) {GfoTstr.EqLines(expd, sqlbldr.Bld_alter_tbl_add(tbl, fld));}
|
||||
}
|
||||
|
||||
@@ -17,10 +17,10 @@ package gplx.dbs.sqls.wtrs; import gplx.*; import gplx.dbs.*; import gplx.dbs.sq
|
||||
import org.junit.*;
|
||||
public class Sql_select_wtr_tst {
|
||||
private final Sql_core_wtr_fxt fxt = new Sql_core_wtr_fxt();
|
||||
@Test public void Offset__automatically_add_limit() {
|
||||
@Test public void Offset__automatically_add_limit() {
|
||||
fxt.Test__qry(Db_qry_.select_tbl_("tbl").Offset_(1), "SELECT * FROM tbl LIMIT -1 OFFSET 1");
|
||||
}
|
||||
@Test public void Offset__do_not_overwrite_limit() {
|
||||
@Test public void Offset__do_not_overwrite_limit() {
|
||||
fxt.Test__qry(Db_qry_.select_tbl_("tbl").Limit_(20).Offset_(1), "SELECT * FROM tbl LIMIT 20 OFFSET 1");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,29 +14,27 @@ GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.dbs.sqls.wtrs;
|
||||
import gplx.Byte_;
|
||||
import gplx.DateAdp_;
|
||||
import gplx.Decimal_adp_;
|
||||
import gplx.Short_;
|
||||
import gplx.objects.primitives.BoolUtl;
|
||||
import gplx.types.commons.GfoDateUtl;
|
||||
import gplx.types.commons.GfoDecimalUtl;
|
||||
import gplx.types.basics.utls.BoolUtl;
|
||||
import gplx.types.basics.utls.ByteUtl;
|
||||
import org.junit.Test;
|
||||
public class Sql_val_wtr_tst {
|
||||
private final Sql_core_wtr_fxt fxt = new Sql_core_wtr_fxt();
|
||||
@Test public void Null() {fxt.Test__val(null , "NULL");}
|
||||
@Test public void Bool__n() {fxt.Test__val(BoolUtl.N , "0");}
|
||||
@Test public void Bool__y() {fxt.Test__val(BoolUtl.Y , "1");}
|
||||
@Test public void Byte() {fxt.Test__val(Byte_.By_int(2) , "2");}
|
||||
@Test public void Short() {fxt.Test__val(Short_.By_int(3) , "3");}
|
||||
@Test public void Int() {fxt.Test__val(4 , "4");}
|
||||
@Test public void Long() {fxt.Test__val(5 , "5");}
|
||||
@Test public void Float() {fxt.Test__val(6.1f , "6.1");}
|
||||
@Test public void Double() {fxt.Test__val(7.1d , "7.1");}
|
||||
@Test public void Decimal() {fxt.Test__val(Decimal_adp_.float_(8) , "'8'");}
|
||||
@Test public void Str() {fxt.Test__val("abc" , "'abc'");}
|
||||
@Test public void Str__apos_mid() {fxt.Test__val("a'b" , "'a''b'");}
|
||||
@Test public void Str__apos_bgn() {fxt.Test__val("'ab" , "'''ab'");}
|
||||
@Test public void Str__apos_end() {fxt.Test__val("ab'" , "'ab'''");}
|
||||
@Test public void Str__apos_many() {fxt.Test__val("a'b'c" , "'a''b''c'");}
|
||||
@Test public void Str__back() {fxt.Test__val("a\\b" , "'a\\b'");}
|
||||
@Test public void Date() {fxt.Test__val(DateAdp_.parse_gplx("2016-02-03") , "'2016-02-03 00:00:00.000'");}
|
||||
@Test public void Null() {fxt.Test__val(null , "NULL");}
|
||||
@Test public void Bool__n() {fxt.Test__val(BoolUtl.N , "0");}
|
||||
@Test public void Bool__y() {fxt.Test__val(BoolUtl.Y , "1");}
|
||||
@Test public void Byte() {fxt.Test__val(ByteUtl.ByInt(2) , "2");}
|
||||
@Test public void Int() {fxt.Test__val(4 , "4");}
|
||||
@Test public void Long() {fxt.Test__val(5 , "5");}
|
||||
@Test public void Float() {fxt.Test__val(6.1f , "6.1");}
|
||||
@Test public void Double() {fxt.Test__val(7.1d , "7.1");}
|
||||
@Test public void Decimal() {fxt.Test__val(GfoDecimalUtl.NewByFloat(8) , "'8'");}
|
||||
@Test public void Str() {fxt.Test__val("abc" , "'abc'");}
|
||||
@Test public void Str__apos_mid() {fxt.Test__val("a'b" , "'a''b'");}
|
||||
@Test public void Str__apos_bgn() {fxt.Test__val("'ab" , "'''ab'");}
|
||||
@Test public void Str__apos_end() {fxt.Test__val("ab'" , "'ab'''");}
|
||||
@Test public void Str__apos_many() {fxt.Test__val("a'b'c" , "'a''b''c'");}
|
||||
@Test public void Str__back() {fxt.Test__val("a\\b" , "'a\\b'");}
|
||||
@Test public void Date() {fxt.Test__val(GfoDateUtl.ParseGplx("2016-02-03") , "'2016-02-03 00:00:00.000'");}
|
||||
}
|
||||
|
||||
@@ -19,16 +19,16 @@ import gplx.dbs.Db_crt_;
|
||||
import org.junit.Test;
|
||||
public class Sql_where_wtr_tst {
|
||||
private final Sql_core_wtr_fxt fxt = new Sql_core_wtr_fxt();
|
||||
@Test public void Eq() {fxt.Test__where(Db_crt_.New_eq ("fld", 1) , "fld = 1");}
|
||||
@Test public void Eq_not() {fxt.Test__where(Db_crt_.New_eq_not ("fld", 1) , "fld != 1");}
|
||||
@Test public void Eq_pre() {fxt.Test__where(Db_crt_.New_eq ("a", "fld", 1) , "a.fld = 1");}
|
||||
@Test public void Lt() {fxt.Test__where(Db_crt_.New_lt ("fld", 1) , "fld < 1");}
|
||||
@Test public void Lte() {fxt.Test__where(Db_crt_.New_lte ("fld", 1) , "fld <= 1");}
|
||||
@Test public void Mt() {fxt.Test__where(Db_crt_.New_mt ("fld", 1) , "fld > 1");}
|
||||
@Test public void Mte() {fxt.Test__where(Db_crt_.New_mte ("fld", 1) , "fld >= 1");}
|
||||
@Test public void Between() {fxt.Test__where(Db_crt_.New_between ("fld", 1, 3) , "fld BETWEEN 1 AND 3");}
|
||||
@Test public void In() {fxt.Test__where(Db_crt_.New_in ("fld", 1, 2, 3) , "fld IN (1, 2, 3)");}
|
||||
@Test public void Like() {fxt.Test__where(Db_crt_.New_like ("fld", "A%") , "fld LIKE 'A%' ESCAPE '|'");}
|
||||
@Test public void Eq() {fxt.Test__where(Db_crt_.New_eq ("fld", 1) , "fld = 1");}
|
||||
@Test public void Eq_not() {fxt.Test__where(Db_crt_.New_eq_not ("fld", 1) , "fld != 1");}
|
||||
@Test public void Eq_pre() {fxt.Test__where(Db_crt_.New_eq ("a", "fld", 1) , "a.fld = 1");}
|
||||
@Test public void Lt() {fxt.Test__where(Db_crt_.New_lt ("fld", 1) , "fld < 1");}
|
||||
@Test public void Lte() {fxt.Test__where(Db_crt_.New_lte ("fld", 1) , "fld <= 1");}
|
||||
@Test public void Mt() {fxt.Test__where(Db_crt_.New_mt ("fld", 1) , "fld > 1");}
|
||||
@Test public void Mte() {fxt.Test__where(Db_crt_.New_mte ("fld", 1) , "fld >= 1");}
|
||||
@Test public void Between() {fxt.Test__where(Db_crt_.New_between ("fld", 1, 3) , "fld BETWEEN 1 AND 3");}
|
||||
@Test public void In() {fxt.Test__where(Db_crt_.New_in ("fld", 1, 2, 3) , "fld IN (1, 2, 3)");}
|
||||
@Test public void Like() {fxt.Test__where(Db_crt_.New_like ("fld", "A%") , "fld LIKE 'A%' ESCAPE '|'");}
|
||||
@Test public void And__subs__2() {
|
||||
fxt.Test__where
|
||||
( Criteria_.And
|
||||
|
||||
@@ -13,7 +13,8 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.dbs.utls; import gplx.*; import gplx.dbs.*;
|
||||
package gplx.dbs.utls; import gplx.dbs.*;
|
||||
import gplx.frameworks.tests.GfoTstr;
|
||||
import org.junit.*;
|
||||
public class PoolIds_tst {
|
||||
@Before public void setup() {
|
||||
@@ -47,7 +48,7 @@ public class PoolIds_tst {
|
||||
}
|
||||
void tst_Fetch(String url, int expd) {
|
||||
int actl = mgr.FetchNext(conn, url);
|
||||
Tfds.Eq(expd, actl);
|
||||
GfoTstr.EqObj(expd, actl);
|
||||
}
|
||||
Db_conn conn;
|
||||
PoolIds mgr;
|
||||
|
||||
Reference in New Issue
Block a user