mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v3.1.3.1
This commit is contained in:
@@ -20,7 +20,7 @@ import gplx.dbs.metas.updates.*;
|
||||
public class Schema_db_mgr {
|
||||
public Schema_loader_mgr Loader() {return loader;} public void Loader_(Schema_loader_mgr v) {loader = v;} private Schema_loader_mgr loader;
|
||||
public Schema_update_mgr Updater() {return updater;} private final Schema_update_mgr updater = new Schema_update_mgr();
|
||||
public Meta_tbl_mgr Tbl_mgr() {return tbl_mgr;} private final Meta_tbl_mgr tbl_mgr = new Meta_tbl_mgr();
|
||||
public Dbmeta_tbl_mgr Tbl_mgr() {return tbl_mgr;} private final Dbmeta_tbl_mgr tbl_mgr = new Dbmeta_tbl_mgr();
|
||||
public void Init(Db_conn conn) {
|
||||
loader.Load(this, conn);
|
||||
updater.Update(this, conn);
|
||||
|
||||
@@ -27,21 +27,20 @@ class Schema_loader_mgr__null implements Schema_loader_mgr {
|
||||
class Schema_loader_mgr__sqlite implements Schema_loader_mgr {
|
||||
public void Load(Schema_db_mgr db_mgr, Db_conn conn) {
|
||||
Gfo_usr_dlg_.Instance.Log_many("", "", "db.schema.load.bgn: conn=~{0}", conn.Conn_info().Xto_api());
|
||||
Meta_tbl_mgr tbl_mgr = db_mgr.Tbl_mgr();
|
||||
Dbmeta_tbl_mgr tbl_mgr = db_mgr.Tbl_mgr();
|
||||
Db_qry__select_in_tbl qry = Db_qry__select_in_tbl.new_("sqlite_master", String_.Ary_empty, String_.Ary("type", "name", "sql"), Db_qry__select_in_tbl.Order_by_null);
|
||||
Db_rdr rdr = conn.Stmt_new(qry).Exec_select__rls_auto();
|
||||
try {
|
||||
while (rdr.Move_next()) {
|
||||
String type_str = rdr.Read_str("type");
|
||||
String name = rdr.Read_str("name");
|
||||
String sql = rdr.Read_str("sql");
|
||||
int type_int = Meta_itm_tid.Xto_int(type_str);
|
||||
int type_int = Dbmeta_itm_tid.Xto_int(type_str);
|
||||
switch (type_int) {
|
||||
case Meta_itm_tid.Tid_table:
|
||||
Meta_tbl_itm tbl_itm = new Meta_tbl_itm(name, sql);
|
||||
case Dbmeta_itm_tid.Tid_table:
|
||||
Dbmeta_tbl_itm tbl_itm = Dbmeta_tbl_itm.New(name);
|
||||
tbl_mgr.Add(tbl_itm);
|
||||
break;
|
||||
case Meta_itm_tid.Tid_index: break; // noop for now
|
||||
case Dbmeta_itm_tid.Tid_index: break; // noop for now
|
||||
default: throw Err_.new_unhandled(type_str);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class Schema_update_mgr_tst {
|
||||
fxt.Test_exec_y(new Schema_update_cmd__mock());
|
||||
}
|
||||
@Test public void Delete() {
|
||||
fxt.Init_itm(Meta_itm_tid.Tid_table, Schema_update_cmd__mock.Tbl_name);
|
||||
fxt.Init_itm(Dbmeta_itm_tid.Tid_table, Schema_update_cmd__mock.Tbl_name);
|
||||
fxt.Test_exec_n(new Schema_update_cmd__mock());
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ class Schema_update_mgr_fxt {
|
||||
db_mgr = new Schema_db_mgr();
|
||||
}
|
||||
public void Init_itm(int tid, String name) {
|
||||
db_mgr.Tbl_mgr().Add(new Meta_tbl_itm(name, "sql"));
|
||||
db_mgr.Tbl_mgr().Add(Dbmeta_tbl_itm.New(name));
|
||||
}
|
||||
public void Test_exec_y(Schema_update_cmd cmd) {Test_exec(cmd, Bool_.Y);}
|
||||
public void Test_exec_n(Schema_update_cmd cmd) {Test_exec(cmd, Bool_.N);}
|
||||
|
||||
Reference in New Issue
Block a user