1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00
This commit is contained in:
gnosygnu
2016-01-17 23:18:07 -05:00
parent 096045614c
commit 235228976e
314 changed files with 4458 additions and 2694 deletions

View File

@@ -37,7 +37,7 @@ public class Db_qry_insert implements Db_qry_arg_owner {
public Db_qry_arg_owner Arg_(String k, byte[] v) {return Arg_obj_type_(k, String_.new_u8(v), Db_val_type.Tid_varchar);}
public Db_qry_arg_owner Arg_obj_(String k, Object v) {return Arg_obj_type_(k, v, Db_val_type.Tid_null);}
public Db_qry_arg_owner Arg_obj_type_(String key, Object val, byte val_tid) {
if (key == Db_meta_fld.Key_null) return this;
if (key == Dbmeta_fld_itm.Key_null) return this;
Db_arg arg = new Db_arg(key, val).Val_tid_(val_tid);
args.Add(arg.Key(), arg);
return this;

View File

@@ -37,7 +37,7 @@ public class Db_qry_update implements Db_qry_arg_owner {
public Db_qry_arg_owner Arg_(String k, byte[] v) {return Arg_obj_type_(k, String_.new_u8(v), Db_val_type.Tid_varchar);}
public Db_qry_arg_owner Arg_obj_(String k, Object v) {return Arg_obj_type_(k, v, Db_val_type.Tid_null);}
public Db_qry_arg_owner Arg_obj_type_(String key, Object val, byte val_tid) {
if (key == Db_meta_fld.Key_null) return this;
if (key == Dbmeta_fld_itm.Key_null) return this;
Db_arg arg = new Db_arg(key, val).Val_tid_(val_tid);
args.Add(arg.Key(), arg);
return this;

View File

@@ -41,7 +41,7 @@ public class Db_stmt_cmd implements Db_stmt {
public Db_stmt Val_byte(String k, byte v) {return Add_byte(Bool_.N, k, v);}
public Db_stmt Val_byte(byte v) {return Add_byte(Bool_.N, Key_na, v);}
private Db_stmt Add_byte(boolean where, String k, byte v) {
if (k == Db_meta_fld.Key_null) return this; // key is explicitly null; ignore; allows version_2+ type definitions
if (k == Dbmeta_fld_itm.Key_null) return this; // key is explicitly null; ignore; allows version_2+ type definitions
try {stmt.setByte(++val_idx, v);} catch (Exception e) {this.Rls(); throw Err_.new_exc(e, "db", "failed to add value", "type", "byte", "val", v, "sql", sql);}
return this;
}
@@ -50,7 +50,7 @@ public class Db_stmt_cmd implements Db_stmt {
public Db_stmt Val_int(String k, int v) {return Add_int(Bool_.N, k, v);}
public Db_stmt Val_int(int v) {return Add_int(Bool_.N, Key_na, v);}
private Db_stmt Add_int(boolean where, String k, int v) {
if (k == Db_meta_fld.Key_null) return this; // key is explicitly null; ignore; allows version_2+ type definitions
if (k == Dbmeta_fld_itm.Key_null) return this; // key is explicitly null; ignore; allows version_2+ type definitions
try {stmt.setInt(++val_idx, v);} catch (Exception e) {this.Rls(); throw Err_.new_exc(e, "db", "failed to add value", "type", "int", "val", v, "sql", sql);}
return this;
}
@@ -58,7 +58,7 @@ public class Db_stmt_cmd implements Db_stmt {
public Db_stmt Val_long(String k, long v) {return Add_long(Bool_.N, k, v);}
public Db_stmt Val_long(long v) {return Add_long(Bool_.N, Key_na, v);}
private Db_stmt Add_long(boolean where, String k, long v) {
if (k == Db_meta_fld.Key_null) return this; // key is explicitly null; ignore; allows version_2+ type definitions
if (k == Dbmeta_fld_itm.Key_null) return this; // key is explicitly null; ignore; allows version_2+ type definitions
try {stmt.setLong(++val_idx, v);} catch (Exception e) {this.Rls(); throw Err_.new_exc(e, "db", "failed to add value", "type", "long", "val", v, "sql", sql);}
return this;
}
@@ -66,7 +66,7 @@ public class Db_stmt_cmd implements Db_stmt {
public Db_stmt Val_float(String k, float v) {return Add_float(Bool_.N, k, v);}
public Db_stmt Val_float(float v) {return Add_float(Bool_.N, Key_na, v);}
private Db_stmt Add_float(boolean where, String k, float v) {
if (k == Db_meta_fld.Key_null) return this; // key is explicitly null; ignore; allows version_2+ type definitions
if (k == Dbmeta_fld_itm.Key_null) return this; // key is explicitly null; ignore; allows version_2+ type definitions
try {stmt.setFloat(++val_idx, v);} catch (Exception e) {this.Rls(); throw Err_.new_exc(e, "db", "failed to add value", "type", "float", "val", v, "sql", sql);}
return this;
}
@@ -74,7 +74,7 @@ public class Db_stmt_cmd implements Db_stmt {
public Db_stmt Val_double(String k, double v) {return Add_double(Bool_.N, k, v);}
public Db_stmt Val_double(double v) {return Add_double(Bool_.N, Key_na, v);}
private Db_stmt Add_double(boolean where, String k, double v) {
if (k == Db_meta_fld.Key_null) return this; // key is explicitly null; ignore; allows version_2+ type definitions
if (k == Dbmeta_fld_itm.Key_null) return this; // key is explicitly null; ignore; allows version_2+ type definitions
try {stmt.setDouble(++val_idx, v);} catch (Exception e) {this.Rls(); throw Err_.new_exc(e, "db", "failed to add value", "type", "double", "val", v, "sql", sql);}
return this;
}
@@ -82,7 +82,7 @@ public class Db_stmt_cmd implements Db_stmt {
public Db_stmt Val_decimal(String k, Decimal_adp v) {return Add_decimal(Bool_.N, k, v);}
public Db_stmt Val_decimal(Decimal_adp v) {return Add_decimal(Bool_.N, Key_na, v);}
private Db_stmt Add_decimal(boolean where, String k, Decimal_adp v) {
if (k == Db_meta_fld.Key_null) return this; // key is explicitly null; ignore; allows version_2+ type definitions
if (k == Dbmeta_fld_itm.Key_null) return this; // key is explicitly null; ignore; allows version_2+ type definitions
try {stmt.setBigDecimal(++val_idx, v.Under_as_native());} catch (Exception e) {this.Rls(); throw Err_.new_exc(e, "db", "failed to add value", "type", "decimal", "val", v, "sql", sql);}
return this;
}
@@ -90,7 +90,7 @@ public class Db_stmt_cmd implements Db_stmt {
public Db_stmt Val_bry(String k, byte[] v) {return Add_bry(Bool_.N, k, v);}
public Db_stmt Val_bry(byte[] v) {return Add_bry(Bool_.N, Key_na, v);}
private Db_stmt Add_bry(boolean where, String k, byte[] v) {
if (k == Db_meta_fld.Key_null) return this; // key is explicitly null; ignore; allows version_2+ type definitions
if (k == Dbmeta_fld_itm.Key_null) return this; // key is explicitly null; ignore; allows version_2+ type definitions
try {stmt.setBytes(++val_idx, v);} catch (Exception e) {this.Rls(); throw Err_.new_exc(e, "db", "failed to add value", "type", "byte[]", v.length, sql);}
return this;
}
@@ -102,7 +102,7 @@ public class Db_stmt_cmd implements Db_stmt {
public Db_stmt Val_str(String k, String v) {return Add_str(Bool_.N, k, v);}
public Db_stmt Val_str(String v) {return Add_str(Bool_.N, Key_na, v);}
private Db_stmt Add_str(boolean where, String k, String v) {
if (k == Db_meta_fld.Key_null) return this; // key is explicitly null; ignore; allows version_2+ type definitions
if (k == Dbmeta_fld_itm.Key_null) return this; // key is explicitly null; ignore; allows version_2+ type definitions
try {stmt.setString(++val_idx, v);} catch (Exception e) {this.Rls(); throw Err_.new_exc(e, "db", "failed to add value", "type", "String", "val", v, "sql", sql);}
return this;
}

View File

@@ -125,7 +125,7 @@ public class Db_stmt_sql implements Db_stmt {// used for formatting SQL statemen
}
public void Rls() {this.Clear();}
public void Add(String k, String v) {
if (k == Db_meta_fld.Key_null) return; // key is explicitly null; ignore; allows version_2+ type definitions
if (k == Dbmeta_fld_itm.Key_null) return; // key is explicitly null; ignore; allows version_2+ type definitions
args.Add(v);
}
public String Xto_sql() {