mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
User_wiki: Simplify creation of wiki database file and tables
This commit is contained in:
@@ -93,7 +93,7 @@ public class Fsdb_db_mgr__v2_bldr {
|
||||
switch (layout.Tid()) {
|
||||
case Xow_db_layout.Tid__all: return Xow_db_file_.Tid__core;
|
||||
case Xow_db_layout.Tid__few: return Xow_db_file_.Tid__file_solo;
|
||||
case Xow_db_layout.Tid__lot: return Xow_db_file_.Tid__file_core;
|
||||
case Xow_db_layout.Tid__lot: return Xow_db_file_.Tid__file_core;
|
||||
default: throw Err_.new_unimplemented();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.fsdb.data; import gplx.*; import gplx.fsdb.*;
|
||||
import gplx.dbs.*;
|
||||
public class Fsd_dir_tbl implements Rls_able {
|
||||
private final String tbl_name = "fsdb_dir"; private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
|
||||
public class Fsd_dir_tbl implements Db_tbl {
|
||||
private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
|
||||
private final String fld_id, fld_owner_id, fld_name;
|
||||
private final Db_conn conn; private Db_stmt stmt_select_by_name;
|
||||
public Fsd_dir_tbl(Db_conn conn, boolean schema_is_1) {
|
||||
@@ -28,9 +28,7 @@ public class Fsd_dir_tbl implements Rls_able {
|
||||
this.fld_name = flds.Add_str ("dir_name", 255);
|
||||
conn.Rls_reg(this);
|
||||
}
|
||||
public void Rls() {
|
||||
stmt_select_by_name = Db_stmt_.Rls(stmt_select_by_name);
|
||||
}
|
||||
public String Tbl_name() {return tbl_name;} private final String tbl_name = "fsdb_dir";
|
||||
public void Create_tbl() {
|
||||
conn.Meta_tbl_create
|
||||
( Dbmeta_tbl_itm.New(tbl_name, flds
|
||||
@@ -65,4 +63,7 @@ public class Fsd_dir_tbl implements Rls_able {
|
||||
}
|
||||
finally {rdr.Rls();}
|
||||
}
|
||||
public void Rls() {
|
||||
stmt_select_by_name = Db_stmt_.Rls(stmt_select_by_name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.fsdb.data; import gplx.*; import gplx.fsdb.*;
|
||||
import gplx.dbs.*; import gplx.dbs.qrys.*; import gplx.dbs.engines.sqlite.*;
|
||||
public class Fsd_fil_tbl implements Rls_able {
|
||||
public final String tbl_name = "fsdb_fil"; public final Dbmeta_fld_list flds = new Dbmeta_fld_list();
|
||||
public class Fsd_fil_tbl implements Db_tbl {
|
||||
public final Dbmeta_fld_list flds = new Dbmeta_fld_list();
|
||||
public final String fld_id, fld_owner_id, fld_name, fld_xtn_id, fld_ext_id, fld_size, fld_modified, fld_hash, fld_bin_db_id;
|
||||
private final String idx_owner;
|
||||
public final Db_conn conn; private Db_stmt stmt_insert, stmt_update, stmt_select_by_name; private int mnt_id;
|
||||
@@ -36,6 +36,7 @@ public class Fsd_fil_tbl implements Rls_able {
|
||||
this.idx_owner = Dbmeta_idx_itm.Bld_idx_name(tbl_name, "owner");
|
||||
conn.Rls_reg(this);
|
||||
}
|
||||
public String Tbl_name() {return tbl_name;} private final String tbl_name = "fsdb_fil";
|
||||
public void Rls() {
|
||||
stmt_insert = Db_stmt_.Rls(stmt_insert);
|
||||
stmt_update = Db_stmt_.Rls(stmt_update);
|
||||
|
||||
@@ -17,8 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.fsdb.data; import gplx.*; import gplx.fsdb.*;
|
||||
import gplx.dbs.*; import gplx.fsdb.meta.*; import gplx.xowa.files.*;
|
||||
public class Fsd_thm_tbl implements Rls_able {
|
||||
public final String tbl_name; public final Dbmeta_fld_list flds = new Dbmeta_fld_list();
|
||||
public class Fsd_thm_tbl implements Db_tbl {
|
||||
public final Dbmeta_fld_list flds = new Dbmeta_fld_list();
|
||||
public final String fld_id, fld_owner_id, fld_w, fld_h, fld_time, fld_page, fld_bin_db_id, fld_size, fld_modified, fld_hash;
|
||||
public final Db_conn conn; private Db_stmt stmt_insert, stmt_select_by_fil_exact, stmt_select_by_fil_near; private int mnt_id; private boolean schema_thm_page;
|
||||
public Fsd_thm_tbl(Db_conn conn, boolean schema_is_1, int mnt_id, boolean schema_thm_page) {
|
||||
@@ -42,11 +42,7 @@ public class Fsd_thm_tbl implements Rls_able {
|
||||
this.fld_hash = flds.Add_str ("thm_hash", 40);
|
||||
conn.Rls_reg(this);
|
||||
}
|
||||
public void Rls() {
|
||||
stmt_insert = Db_stmt_.Rls(stmt_insert);
|
||||
stmt_select_by_fil_exact = Db_stmt_.Rls(stmt_select_by_fil_exact);
|
||||
stmt_select_by_fil_near = Db_stmt_.Rls(stmt_select_by_fil_near);
|
||||
}
|
||||
public String Tbl_name() {return tbl_name;} private final String tbl_name;
|
||||
public void Create_tbl() {
|
||||
conn.Meta_tbl_create(Dbmeta_tbl_itm.New(tbl_name, flds
|
||||
, Dbmeta_idx_itm.new_unique_by_tbl(tbl_name, "owner", fld_owner_id, fld_id, fld_w, fld_time, fld_page)
|
||||
@@ -155,4 +151,9 @@ public class Fsd_thm_tbl implements Rls_able {
|
||||
thm.Init_by_match(max);
|
||||
return Bool_.Y;
|
||||
}
|
||||
public void Rls() {
|
||||
stmt_insert = Db_stmt_.Rls(stmt_insert);
|
||||
stmt_select_by_fil_exact = Db_stmt_.Rls(stmt_select_by_fil_exact);
|
||||
stmt_select_by_fil_near = Db_stmt_.Rls(stmt_select_by_fil_near);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.fsdb.meta; import gplx.*; import gplx.fsdb.*;
|
||||
import gplx.dbs.*; import gplx.dbs.qrys.*;
|
||||
public class Fsm_atr_tbl {
|
||||
public final String tbl_name; public final Dbmeta_fld_list flds = new Dbmeta_fld_list();
|
||||
public class Fsm_atr_tbl implements Db_tbl {
|
||||
public final Dbmeta_fld_list flds = new Dbmeta_fld_list();
|
||||
private final String fld_uid, fld_url;
|
||||
private final Db_conn conn;
|
||||
public Fsm_atr_tbl(Db_conn conn, boolean schema_is_1) {
|
||||
@@ -29,6 +29,7 @@ public class Fsm_atr_tbl {
|
||||
this.fld_uid = flds.Add_int_pkey (fld_prefix + "uid");
|
||||
this.fld_url = flds.Add_str (fld_prefix + "url", 255);
|
||||
}
|
||||
public String Tbl_name() {return tbl_name;} private final String tbl_name;
|
||||
public void Create_tbl() {conn.Meta_tbl_create(Dbmeta_tbl_itm.New(tbl_name, flds));}
|
||||
public Fsm_atr_fil Select_1st_or_fail(Fsm_mnt_itm mnt_itm, Fsdb_db_mgr core_mgr, int mnt_id, boolean schema_thm_page) {
|
||||
Db_rdr rdr = conn.Stmt_select(tbl_name, flds, Dbmeta_fld_itm.Str_ary_empty).Exec_select__rls_auto();
|
||||
@@ -52,4 +53,8 @@ public class Fsm_atr_tbl {
|
||||
public void Insert(int id, String url_rel) {
|
||||
conn.Stmt_insert(tbl_name, flds).Val_int(fld_uid, id).Val_str(fld_url, url_rel).Exec_insert();
|
||||
}
|
||||
public void Rls() {}
|
||||
|
||||
public static final String TBL_NAME = "fsdb_dba";
|
||||
public static Fsm_atr_tbl Get_by_key(Db_tbl_owner owner) {return (Fsm_atr_tbl)owner.Tbls__get_by_key(TBL_NAME);}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.fsdb.meta; import gplx.*; import gplx.fsdb.*;
|
||||
import gplx.dbs.*; import gplx.dbs.qrys.*;
|
||||
public class Fsm_bin_tbl {
|
||||
private final String tbl_name; private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
|
||||
public class Fsm_bin_tbl implements Db_tbl {
|
||||
private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
|
||||
private final String fld_uid, fld_url, fld_bin_len, fld_bin_max;
|
||||
private final Db_conn conn; private int mnt_id;
|
||||
public Fsm_bin_tbl(Db_conn conn, boolean schema_is_1, int mnt_id) {
|
||||
@@ -37,6 +37,7 @@ public class Fsm_bin_tbl {
|
||||
fld_bin_max = Dbmeta_fld_itm.Key_null;
|
||||
}
|
||||
}
|
||||
public String Tbl_name() {return tbl_name;} private final String tbl_name;
|
||||
public void Create_tbl() {conn.Meta_tbl_create(Dbmeta_tbl_itm.New(tbl_name, flds));}
|
||||
public void Insert(int id, String url_rel) {
|
||||
conn.Stmt_insert(tbl_name, flds).Crt_int(fld_uid, id).Val_str(fld_url, url_rel).Val_long(fld_bin_len, 0).Val_long(fld_bin_max, 0).Exec_insert();
|
||||
@@ -55,4 +56,5 @@ public class Fsm_bin_tbl {
|
||||
} finally {rdr.Rls();}
|
||||
return (Fsm_bin_fil[])rv.To_ary(Fsm_bin_fil.class);
|
||||
}
|
||||
public void Rls() {}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.fsdb.meta; import gplx.*; import gplx.fsdb.*;
|
||||
import gplx.dbs.*;
|
||||
public class Fsm_mnt_tbl implements Rls_able {
|
||||
private final String tbl_name = "fsdb_mnt"; private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
|
||||
public class Fsm_mnt_tbl implements Db_tbl {
|
||||
private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
|
||||
private final String fld_id, fld_name, fld_url;
|
||||
private final Db_conn conn;
|
||||
public Fsm_mnt_tbl(Db_conn conn, boolean schema_is_1) {
|
||||
@@ -28,6 +28,7 @@ public class Fsm_mnt_tbl implements Rls_able {
|
||||
fld_url = flds.Add_str ("mnt_url", 255);
|
||||
conn.Rls_reg(this);
|
||||
}
|
||||
public String Tbl_name() {return tbl_name;} private final String tbl_name = "fsdb_mnt";
|
||||
public void Create_tbl() {
|
||||
Dbmeta_tbl_itm meta = Dbmeta_tbl_itm.New(tbl_name, flds);
|
||||
conn.Meta_tbl_create(meta);
|
||||
|
||||
Reference in New Issue
Block a user