mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.10.3.1
This commit is contained in:
@@ -21,8 +21,8 @@ public class Db_qry__select_cmd implements Db_qry {
|
||||
public int Tid() {return Db_qry_.Tid_select;}
|
||||
public boolean Exec_is_rdr() {return true;}
|
||||
public String Base_table() {return from.BaseTable().TblName();}
|
||||
public String Xto_sql() {return Sql_qry_wtr_.I.Xto_str(this, false);}
|
||||
public String Xto_sql_prepare() {return Sql_qry_wtr_.I.Xto_str(this, true);}
|
||||
public String Xto_sql() {return Sql_qry_wtr_.Instance.Xto_str(this, false);}
|
||||
public String Xto_sql_prepare() {return Sql_qry_wtr_.Instance.Xto_str(this, true);}
|
||||
public DataRdr Exec_qry_as_rdr(Db_conn conn) {return conn.Exec_qry_as_rdr(this);}
|
||||
public GfoNde ExecRdr_nde(Db_conn conn) {
|
||||
DataRdr rdr = DataRdr_.Null;
|
||||
|
||||
@@ -73,7 +73,7 @@ public class Db_qry__select_in_tbl implements Db_qry {
|
||||
if (i != 0) bfr.Add_byte_comma();
|
||||
bfr.Add_str_a7(order_fld);
|
||||
}
|
||||
order_by_sql = bfr.Xto_str_and_clear();
|
||||
order_by_sql = bfr.To_str_and_clear();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class Db_qry_delete implements Db_qry {
|
||||
public int Tid() {return Db_qry_.Tid_delete;}
|
||||
public boolean Exec_is_rdr() {return false;}
|
||||
public String Base_table() {return base_table;} private final String base_table;
|
||||
public String Xto_sql() {return Sql_qry_wtr_.I.Xto_str(this, false);}
|
||||
public String Xto_sql() {return Sql_qry_wtr_.Instance.Xto_str(this, false);}
|
||||
public Criteria Where() {return where;} private final Criteria where;
|
||||
public int Exec_qry(Db_conn conn) {return conn.Exec_qry(this);}
|
||||
public static Db_qry_delete new_all_(String tbl) {return new Db_qry_delete(tbl, Criteria_.All);}
|
||||
|
||||
@@ -21,7 +21,7 @@ public class Db_qry_flush implements Db_qry {
|
||||
public int Tid() {return Db_qry_.Tid_flush;}
|
||||
public boolean Exec_is_rdr() {return false;}
|
||||
public String Base_table() {return tableNames[0];}
|
||||
public String Xto_sql() {return Sql_qry_wtr_.I.Xto_str(this, false);}
|
||||
public String Xto_sql() {return Sql_qry_wtr_.Instance.Xto_str(this, false);}
|
||||
public int Exec_qry(Db_conn conn) {return conn.Exec_qry(this);}
|
||||
|
||||
public String[] TableNames() {return tableNames;} private String[] tableNames;
|
||||
|
||||
@@ -21,7 +21,7 @@ public class Db_qry_insert implements Db_qry_arg_owner {
|
||||
public Db_qry_insert(String base_table) {this.base_table = base_table;}
|
||||
public int Tid() {return Db_qry_.Tid_insert;}
|
||||
public boolean Exec_is_rdr() {return false;}
|
||||
public String Xto_sql() {return Sql_qry_wtr_.I.Xto_str(this, false);}
|
||||
public String Xto_sql() {return Sql_qry_wtr_.Instance.Xto_str(this, false);}
|
||||
public int Exec_qry(Db_conn conn) {return conn.Exec_qry(this);}
|
||||
public String Base_table() {return base_table;} private String base_table;
|
||||
public String[] Cols_for_insert() {return cols_for_insert;} private String[] cols_for_insert;
|
||||
|
||||
@@ -52,7 +52,7 @@ public class Db_qry_sql implements Db_qry {
|
||||
Gen_sql_arg(bfr, args[args_idx++]);
|
||||
pos = question_pos + 1;
|
||||
}
|
||||
return bfr.Xto_str_and_clear();
|
||||
return bfr.To_str_and_clear();
|
||||
}
|
||||
private static void Gen_sql_arg(Bry_bfr bfr, Object val) {
|
||||
if (val == null) {bfr.Add(Bry_null); return;}
|
||||
|
||||
@@ -20,7 +20,7 @@ import gplx.core.criterias.*; import gplx.dbs.sqls.*;
|
||||
public class Db_qry_update implements Db_qry_arg_owner {
|
||||
public int Tid() {return Db_qry_.Tid_update;}
|
||||
public boolean Exec_is_rdr() {return false;}
|
||||
public String Xto_sql() {return Sql_qry_wtr_.I.Xto_str(this, false);}
|
||||
public String Xto_sql() {return Sql_qry_wtr_.Instance.Xto_str(this, false);}
|
||||
public int Exec_qry(Db_conn conn) {return conn.Exec_qry(this);}
|
||||
public String Base_table() {return base_table;} private String base_table;
|
||||
public String[] Cols_for_update() {return cols_for_update;} private String[] cols_for_update;
|
||||
|
||||
@@ -26,7 +26,7 @@ public class Db_stmt_cmd implements Db_stmt {
|
||||
public Db_stmt_cmd(Db_engine engine, Db_qry qry) {Ctor_stmt(engine, qry);}
|
||||
public void Ctor_stmt(Db_engine engine, Db_qry qry) {
|
||||
this.engine = engine;
|
||||
sql = qry.Tid() == Db_qry_.Tid_select_in_tbl ? ((Db_qry__select_in_tbl)qry).Xto_sql() : Sql_qry_wtr_.I.Xto_str(qry, true);
|
||||
sql = qry.Tid() == Db_qry_.Tid_select_in_tbl ? ((Db_qry__select_in_tbl)qry).Xto_sql() : Sql_qry_wtr_.Instance.Xto_str(qry, true);
|
||||
Reset_stmt();
|
||||
}
|
||||
public Db_stmt Reset_stmt() {
|
||||
@@ -46,6 +46,7 @@ public class Db_stmt_cmd implements Db_stmt {
|
||||
return this;
|
||||
}
|
||||
public Db_stmt Crt_int(String k, int v) {return Add_int(Bool_.Y, k, v);}
|
||||
public Db_stmt Val_int_by_bool(String k, boolean v) {return Add_int(Bool_.N, k, v ? 1 : 0);}
|
||||
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) {
|
||||
|
||||
@@ -37,31 +37,32 @@ public class Db_stmt_sql implements Db_stmt {// used for formatting SQL statemen
|
||||
return this;
|
||||
}
|
||||
public Db_stmt Crt_int(String k, int v) {return Add_int(Bool_.Y, k, v);}
|
||||
public Db_stmt Val_int_by_bool(String k, boolean v) {return Add_int(Bool_.N, k, v ? 1 : 0);}
|
||||
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) {
|
||||
try {Add(k, Int_.Xto_str(v));} catch (Exception e) {throw Err_.new_exc(e, "db", "failed to add value", "type", "int", "val", v);}
|
||||
try {Add(k, Int_.To_str(v));} catch (Exception e) {throw Err_.new_exc(e, "db", "failed to add value", "type", "int", "val", v);}
|
||||
return this;
|
||||
}
|
||||
public Db_stmt Crt_long(String k, long v) {return Add_long(Bool_.Y, k, v);}
|
||||
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) {
|
||||
try {Add(k, Long_.Xto_str(v));} catch (Exception e) {throw Err_.new_exc(e, "db", "failed to add value", "type", "long", "val", v);}
|
||||
try {Add(k, Long_.To_str(v));} catch (Exception e) {throw Err_.new_exc(e, "db", "failed to add value", "type", "long", "val", v);}
|
||||
return this;
|
||||
}
|
||||
public Db_stmt Crt_float(String k, float v) {return Add_float(Bool_.Y, k, v);}
|
||||
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) {
|
||||
try {Add(k, Float_.Xto_str(v));} catch (Exception e) {throw Err_.new_exc(e, "db", "failed to add value", "type", "float", "val", v);}
|
||||
try {Add(k, Float_.To_str(v));} catch (Exception e) {throw Err_.new_exc(e, "db", "failed to add value", "type", "float", "val", v);}
|
||||
return this;
|
||||
}
|
||||
public Db_stmt Crt_double(String k, double v) {return Add_double(Bool_.Y, k, v);}
|
||||
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) {
|
||||
try {Add(k, Double_.Xto_str(v));} catch (Exception e) {throw Err_.new_exc(e, "db", "failed to add value", "type", "double", "val", v);}
|
||||
try {Add(k, Double_.To_str(v));} catch (Exception e) {throw Err_.new_exc(e, "db", "failed to add value", "type", "double", "val", v);}
|
||||
return this;
|
||||
}
|
||||
public Db_stmt Crt_decimal(String k, Decimal_adp v) {return Add_decimal(Bool_.Y, k, v);}
|
||||
@@ -93,7 +94,7 @@ public class Db_stmt_sql implements Db_stmt {// used for formatting SQL statemen
|
||||
try {
|
||||
Bry_bfr bfr = Bry_bfr.new_();
|
||||
gplx.ios.Io_stream_rdr_.Load_all_to_bfr(bfr, v);
|
||||
Add(Key_na, bfr.Xto_str_and_clear());
|
||||
Add(Key_na, bfr.To_str_and_clear());
|
||||
} catch (Exception e) {throw Err_.new_exc(e, "db", "failed to add value", "type", "rdr", "val", v);}
|
||||
return this;
|
||||
}
|
||||
@@ -128,7 +129,7 @@ public class Db_stmt_sql implements Db_stmt {// used for formatting SQL statemen
|
||||
}
|
||||
public String Xto_sql() {
|
||||
tmp_fmtr.Bld_bfr_many(tmp_bfr, (Object[])args.To_ary_and_clear(Object.class));
|
||||
return tmp_bfr.Xto_str_and_clear();
|
||||
return tmp_bfr.To_str_and_clear();
|
||||
}
|
||||
public int Args_len() {return args.Count();}
|
||||
public String Args_get_at(int i) {return (String)args.Get_at(i);}
|
||||
@@ -153,7 +154,7 @@ public class Db_stmt_sql implements Db_stmt {// used for formatting SQL statemen
|
||||
pos_prv = pos_cur + 1;
|
||||
}
|
||||
tmp_bfr.Add_mid(sql_bry, pos_prv, sql_bry.length);
|
||||
tmp_fmtr.Fmt_(tmp_bfr.Xto_bry_and_clear());
|
||||
tmp_fmtr.Fmt_(tmp_bfr.To_bry_and_clear());
|
||||
}
|
||||
public static String Xto_str(Bry_bfr tmp_bfr, Bry_fmtr tmp_fmtr, String sql_str, List_adp args) {
|
||||
Init_fmtr(tmp_bfr, tmp_fmtr, sql_str);
|
||||
@@ -172,6 +173,6 @@ public class Db_stmt_sql implements Db_stmt {// used for formatting SQL statemen
|
||||
ary[i] = str;
|
||||
}
|
||||
tmp_fmtr.Bld_bfr_many(tmp_bfr, ary);
|
||||
return tmp_bfr.Xto_str_and_clear();
|
||||
return tmp_bfr.To_str_and_clear();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user