mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
'v3.9.4.1'
This commit is contained in:
@@ -24,11 +24,11 @@ public class Fsd_bin_itm {
|
||||
this.bin_data_url = bin_data_url;
|
||||
this.bin_data = bin_data;
|
||||
}
|
||||
public int Bin_owner_id() {return bin_owner_id;} private final int bin_owner_id;
|
||||
public byte Bin_owner_tid() {return bin_owner_tid;} private final byte bin_owner_tid;
|
||||
public int Bin_part_id() {return bin_part_id;} private final int bin_part_id;
|
||||
public String Bin_data_url() {return bin_data_url;} private final String bin_data_url;
|
||||
public byte[] Bin_data() {return bin_data;} private final byte[] bin_data;
|
||||
public int Bin_owner_id() {return bin_owner_id;} private final int bin_owner_id;
|
||||
public byte Bin_owner_tid() {return bin_owner_tid;} private final byte bin_owner_tid;
|
||||
public int Bin_part_id() {return bin_part_id;} private final int bin_part_id;
|
||||
public String Bin_data_url() {return bin_data_url;} private final String bin_data_url;
|
||||
public byte[] Bin_data() {return bin_data;} private final byte[] bin_data;
|
||||
|
||||
public static final int Db_row_size_fixed = (3 * 4); // bin_owner_id, bin_part_id, bin_owner_tid (assume byte saved as int in SQLITE)
|
||||
}
|
||||
|
||||
@@ -17,10 +17,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.fsdb.data; import gplx.*; import gplx.fsdb.*;
|
||||
public class Fsd_dir_itm {
|
||||
public Fsd_dir_itm(int dir_id, int owner, byte[] name) {this.dir_id = dir_id; this.owner = owner; this.name = name;}
|
||||
public int Dir_id() {return dir_id;} private final int dir_id;
|
||||
public int Owner() {return owner;} private final int owner;
|
||||
public byte[] Name() {return name;} private final byte[] name;
|
||||
public Fsd_dir_itm(int dir_id, int owner, byte[] name) {
|
||||
this.dir_id = dir_id;
|
||||
this.owner = owner;
|
||||
this.name = name;
|
||||
}
|
||||
public int Dir_id() {return dir_id;} private final int dir_id;
|
||||
public int Owner() {return owner;} private final int owner;
|
||||
public byte[] Name() {return name;} private final byte[] name;
|
||||
|
||||
public static final int Owner_root = 0;
|
||||
public static final Fsd_dir_itm Null = null;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ 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();
|
||||
private final String fld_id, fld_owner_id, fld_name;
|
||||
private final Db_conn conn; private Db_stmt stmt_insert, stmt_update, stmt_select_by_name;
|
||||
private final Db_conn conn; private Db_stmt stmt_select_by_name;
|
||||
public Fsd_dir_tbl(Db_conn conn, boolean schema_is_1) {
|
||||
this.conn = conn;
|
||||
this.fld_id = flds.Add_int_pkey ("dir_id");
|
||||
@@ -29,8 +29,6 @@ public class Fsd_dir_tbl implements Rls_able {
|
||||
conn.Rls_reg(this);
|
||||
}
|
||||
public void Rls() {
|
||||
stmt_insert = Db_stmt_.Rls(stmt_insert);
|
||||
stmt_update = Db_stmt_.Rls(stmt_update);
|
||||
stmt_select_by_name = Db_stmt_.Rls(stmt_select_by_name);
|
||||
}
|
||||
public void Create_tbl() {
|
||||
@@ -39,20 +37,22 @@ public class Fsd_dir_tbl implements Rls_able {
|
||||
, Dbmeta_idx_itm.new_normal_by_tbl(tbl_name, "name", fld_name, fld_owner_id, fld_id)));
|
||||
}
|
||||
public void Insert(int id, byte[] name, int owner_id) {
|
||||
if (stmt_insert == null) stmt_insert = conn.Stmt_insert(tbl_name, flds);
|
||||
Db_stmt stmt_insert = conn.Stmt_insert(tbl_name, flds);
|
||||
stmt_insert.Clear()
|
||||
.Val_int(fld_id, id)
|
||||
.Val_int(fld_owner_id, owner_id)
|
||||
.Val_bry_as_str(fld_name, name)
|
||||
.Exec_insert();
|
||||
stmt_insert.Rls();
|
||||
}
|
||||
public void Update(int id, byte[] name, int owner_id) {
|
||||
if (stmt_update == null) stmt_update = conn.Stmt_update_exclude(tbl_name, flds, fld_id);
|
||||
Db_stmt stmt_update = conn.Stmt_update_exclude(tbl_name, flds, fld_id);
|
||||
stmt_update.Clear()
|
||||
.Val_int(fld_owner_id, owner_id)
|
||||
.Val_bry_as_str(fld_name, name)
|
||||
.Crt_int(fld_id, id)
|
||||
.Exec_update();
|
||||
stmt_update.Rls();
|
||||
}
|
||||
public Fsd_dir_itm Select_or_null(byte[] name) {
|
||||
if (stmt_select_by_name == null) stmt_select_by_name = conn.Stmt_select(tbl_name, flds, fld_name);
|
||||
|
||||
@@ -17,26 +17,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.fsdb.data; import gplx.*; import gplx.fsdb.*;
|
||||
public class Fsd_fil_itm {
|
||||
public int Mnt_id() {return mnt_id;} private int mnt_id;
|
||||
public int Fil_id() {return fil_id;} private int fil_id;
|
||||
public int Dir_id() {return dir_id;} private int dir_id;
|
||||
public int Xtn_id() {return xtn_id;} private int xtn_id;
|
||||
public int Ext_id() {return ext_id;} private int ext_id;
|
||||
public byte[] Name() {return name;} private byte[] name;
|
||||
public int Bin_db_id() {return bin_db_id;} private int bin_db_id;
|
||||
public long Size() {return size;} private long size;
|
||||
public String Modified_on() {return modified_on;} private String modified_on;
|
||||
public String Hash_md5() {return hash_md5;} private String hash_md5;
|
||||
|
||||
public Fsd_fil_itm Ctor(int mnt_id, int dir_id, int fil_id, int bin_db_id, byte[] name, int ext_id) {
|
||||
this.mnt_id = mnt_id; this.dir_id = dir_id; this.fil_id = fil_id; this.bin_db_id = bin_db_id; this.name = name; this.ext_id = ext_id;
|
||||
return this;
|
||||
}
|
||||
public Fsd_fil_itm Load_by_rdr__full(int mnt_id, int dir_id, int fil_id, int xtn_id, int ext_id, byte[] name, long size, String modified_on, String hash_md5, int bin_db_id) {
|
||||
public Fsd_fil_itm (int mnt_id, int dir_id, int fil_id, int xtn_id, int ext_id, byte[] name, long size, String modified_on, String hash_md5, int bin_db_id) {
|
||||
this.mnt_id = mnt_id; this.dir_id = dir_id; this.fil_id = fil_id; this.xtn_id = xtn_id; this.ext_id = ext_id;
|
||||
this.name = name; this.size = size; this.modified_on = modified_on; this.hash_md5 = hash_md5; this.bin_db_id = bin_db_id;
|
||||
return this;
|
||||
}
|
||||
public int Mnt_id() {return mnt_id;} private final int mnt_id;
|
||||
public int Dir_id() {return dir_id;} private final int dir_id;
|
||||
public int Fil_id() {return fil_id;} private final int fil_id;
|
||||
public int Xtn_id() {return xtn_id;} private final int xtn_id;
|
||||
public int Ext_id() {return ext_id;} private final int ext_id;
|
||||
public byte[] Name() {return name;} private final byte[] name;
|
||||
public long Size() {return size;} private final long size;
|
||||
public String Modified_on() {return modified_on;} private final String modified_on;
|
||||
public String Hash_md5() {return hash_md5;} private final String hash_md5;
|
||||
public int Bin_db_id() {return bin_db_id;} private final int bin_db_id;
|
||||
|
||||
public int Db_row_size() {return Db_row_size_fixed + name.length;}
|
||||
private static final int Db_row_size_fixed =
|
||||
(7 * 4) // 6 int fields + 1 byte field
|
||||
|
||||
@@ -87,7 +87,7 @@ public class Fsd_fil_tbl implements Rls_able {
|
||||
.Crt_bry_as_str(fld_name, fil_name)
|
||||
.Exec_select__rls_manual();
|
||||
try {
|
||||
return rdr.Move_next() ? Load_by_rdr(mnt_id, rdr) : Fsd_fil_itm.Null;
|
||||
return rdr.Move_next() ? New_by_rdr(mnt_id, rdr) : Fsd_fil_itm.Null;
|
||||
}
|
||||
finally {rdr.Rls();}
|
||||
}
|
||||
@@ -95,28 +95,25 @@ public class Fsd_fil_tbl implements Rls_able {
|
||||
Db_rdr rdr = conn.Stmt_select(tbl_name, flds, Dbmeta_fld_itm.Str_ary_empty).Exec_select__rls_auto();
|
||||
try {
|
||||
while (rdr.Move_next()) {
|
||||
Fsd_fil_itm fil = Load_by_rdr(mnt_id, rdr);
|
||||
Fsd_fil_itm fil = New_by_rdr(mnt_id, rdr);
|
||||
byte[] cache_key = Fsd_fil_itm.Gen_cache_key(key_bfr, fil.Dir_id(), fil.Name());
|
||||
cache.Add(cache_key, fil);
|
||||
}
|
||||
}
|
||||
finally {rdr.Rls();}
|
||||
}
|
||||
public Fsd_fil_itm Load_by_rdr(int mnt_id, Db_rdr rdr) {
|
||||
return new Fsd_fil_itm().Ctor(mnt_id, rdr.Read_int(fld_owner_id), rdr.Read_int(fld_id), rdr.Read_int(fld_bin_db_id), rdr.Read_bry_by_str(fld_name), rdr.Read_int(fld_ext_id));
|
||||
}
|
||||
public Fsd_fil_itm Load_by_rdr__full(int mnt_id, Db_rdr rdr) {
|
||||
return new Fsd_fil_itm()
|
||||
.Load_by_rdr__full(mnt_id
|
||||
, rdr.Read_int(fld_owner_id)
|
||||
, rdr.Read_int(fld_id)
|
||||
, rdr.Read_int(fld_xtn_id)
|
||||
, rdr.Read_int(fld_ext_id)
|
||||
, rdr.Read_bry_by_str(fld_name)
|
||||
, rdr.Read_long(fld_size)
|
||||
, rdr.Read_str(fld_modified)
|
||||
, rdr.Read_str(fld_hash)
|
||||
, rdr.Read_int(fld_bin_db_id)
|
||||
);
|
||||
public Fsd_fil_itm New_by_rdr(int mnt_id, Db_rdr rdr) {
|
||||
return new Fsd_fil_itm
|
||||
( mnt_id
|
||||
, rdr.Read_int(fld_owner_id)
|
||||
, rdr.Read_int(fld_id)
|
||||
, rdr.Read_int(fld_xtn_id)
|
||||
, rdr.Read_int(fld_ext_id)
|
||||
, rdr.Read_bry_by_str(fld_name)
|
||||
, rdr.Read_long(fld_size)
|
||||
, rdr.Read_str(fld_modified)
|
||||
, rdr.Read_str(fld_hash)
|
||||
, rdr.Read_int(fld_bin_db_id)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,11 +17,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.fsdb.data; import gplx.*; import gplx.fsdb.*;
|
||||
public class Fsd_img_itm {
|
||||
public void Ctor(int mnt_id, int dir_id, int fil_id, int bin_db_id) {
|
||||
public Fsd_img_itm(int mnt_id, int dir_id, int fil_id, int bin_db_id) {
|
||||
this.mnt_id = mnt_id; this.dir_id = dir_id; this.fil_id = fil_id; this.bin_db_id = bin_db_id;
|
||||
}
|
||||
public int Mnt_id() {return mnt_id;} private int mnt_id;
|
||||
public int Fil_id() {return fil_id;} private int fil_id;
|
||||
public int Dir_id() {return dir_id;} private int dir_id;
|
||||
public int Bin_db_id() {return bin_db_id;} private int bin_db_id;
|
||||
public int Mnt_id() {return mnt_id;} private final int mnt_id;
|
||||
public int Dir_id() {return dir_id;} private final int dir_id;
|
||||
public int Fil_id() {return fil_id;} private final int fil_id;
|
||||
public int Bin_db_id() {return bin_db_id;} private final int bin_db_id;
|
||||
}
|
||||
|
||||
@@ -22,21 +22,21 @@ public class Fsd_thm_itm {
|
||||
this.w = w; this.h = h; this.time = time; this.page = page;
|
||||
this.size = size; this.modified = modified; this.hash = hash;
|
||||
}
|
||||
public int Mnt_id() {return mnt_id;} private int mnt_id;
|
||||
public int Dir_id() {return dir_id;} private int dir_id;
|
||||
public int Fil_id() {return fil_id;} private int fil_id;
|
||||
public int Thm_id() {return thm_id;} private int thm_id;
|
||||
public int Bin_db_id() {return bin_db_id;} private int bin_db_id;
|
||||
public int W() {return w;} private int w;
|
||||
public int H() {return h;} private int h;
|
||||
public double Time() {return time;} private double time;
|
||||
public int Page() {return page;} private int page;
|
||||
public long Size() {return size;} private long size;
|
||||
public String Modified() {return modified;} private String modified;
|
||||
public String Hash() {return hash;} private String hash;
|
||||
public int Req_w() {return req_w;} private int req_w;
|
||||
public double Req_time() {return req_time;} private double req_time;
|
||||
public int Req_page() {return req_page;} private int req_page;
|
||||
public int Mnt_id() {return mnt_id;} private int mnt_id;
|
||||
public int Dir_id() {return dir_id;} private int dir_id;
|
||||
public int Fil_id() {return fil_id;} private int fil_id;
|
||||
public int Thm_id() {return thm_id;} private int thm_id;
|
||||
public int Bin_db_id() {return bin_db_id;} private int bin_db_id;
|
||||
public int W() {return w;} private int w;
|
||||
public int H() {return h;} private int h;
|
||||
public double Time() {return time;} private double time;
|
||||
public int Page() {return page;} private int page;
|
||||
public long Size() {return size;} private long size;
|
||||
public String Modified() {return modified;} private String modified;
|
||||
public String Hash() {return hash;} private String hash;
|
||||
public int Req_w() {return req_w;} private int req_w;
|
||||
public double Req_time() {return req_time;} private double req_time;
|
||||
public int Req_page() {return req_page;} private int req_page;
|
||||
public void Init_by_req(int w, double time, int page) {this.w = w; this.time = time; this.page = page;}
|
||||
public void Init_by_match(Fsd_thm_itm comp) {
|
||||
this.req_w = w; this.req_time = time; this.req_page = page;
|
||||
|
||||
Reference in New Issue
Block a user