1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

'v3.8.1.1'

This commit is contained in:
gnosygnu
2016-07-31 21:41:19 -04:00
parent 8e91ac0bc4
commit b0fdf78a41
388 changed files with 3517 additions and 2553 deletions

View File

@@ -19,23 +19,24 @@ package gplx.dbs; import gplx.*;
import gplx.dbs.sqls.*; import gplx.dbs.sqls.itms.*;
public class Db_attach_mgr {
private Db_conn main_conn; private Io_url main_conn_url;
private final Ordered_hash others_hash = Ordered_hash_.New();
private final Ordered_hash links_hash = Ordered_hash_.New();
private final List_adp attach_list = List_adp_.New();
public Db_attach_mgr() {}
public Db_attach_mgr(Db_conn main_conn, Db_attach_itm... others_ary) {
public Db_attach_mgr(Db_conn main_conn, Db_attach_itm... links_ary) {
this.Conn_main_(main_conn);
this.Conn_others_(others_ary);
this.Conn_links_(links_ary);
}
public Db_conn Conn_main() {return main_conn;}
public Db_attach_mgr Conn_main_(Db_conn conn) {
this.main_conn = conn; this.main_conn_url = Db_conn_info_.To_url(conn.Conn_info());
return this;
}
public Db_attach_mgr Conn_others_(Db_attach_itm... itms_ary) {
others_hash.Clear();
public Db_attach_mgr Conn_links_(Db_attach_itm... itms_ary) {
links_hash.Clear();
int len = itms_ary.length;
for (int i = 0; i < len; ++i) {
Db_attach_itm itm = itms_ary[i];
others_hash.Add(itm.Key, itm);
links_hash.Add(itm.Key, itm);
}
return this;
}
@@ -56,9 +57,9 @@ public class Db_attach_mgr {
}
public String Resolve_sql(String sql) {
attach_list.Clear();
int hash_len = others_hash.Count();
int hash_len = links_hash.Count();
for (int i = 0; i < hash_len; ++i) {
Db_attach_itm attach_itm = (Db_attach_itm)others_hash.Get_at(i);
Db_attach_itm attach_itm = (Db_attach_itm)links_hash.Get_at(i);
String tkn = "<" + attach_itm.Key + ">";
if (String_.Has(sql, tkn)) {
Io_url attach_url = attach_itm.Url;
@@ -104,7 +105,7 @@ public class Db_attach_mgr {
Sql_tbl_itm from_tbl = (Sql_tbl_itm)from_tbls.Get_at(i);
String from_tbl_db = from_tbl.Db;
if (String_.Eq(Sql_tbl_itm.Db__null, from_tbl_db)) continue; // tbl does not have db defined; only "tbl" not "db.tbl"; skip
Db_attach_itm attach_itm = (Db_attach_itm)others_hash.Get_by(from_tbl_db); if (attach_itm == null) throw Err_.new_("dbs", "qry defines an unknown database for attach_wkr", "from_tbl_db", from_tbl_db, "sql", qry.To_sql__exec(sql_wtr));
Db_attach_itm attach_itm = (Db_attach_itm)links_hash.Get_by(from_tbl_db); if (attach_itm == null) throw Err_.new_("dbs", "qry defines an unknown database for attach_wkr", "from_tbl_db", from_tbl_db, "sql", qry.To_sql__exec(sql_wtr));
if (attach_itm.Url.Eq(main_conn_url)) // attach_db same as conn; blank db, so "tbl", not "db.tbl"
from_tbl.Db_enabled = false;
else

View File

@@ -19,10 +19,10 @@ package gplx.dbs.diffs; import gplx.*; import gplx.dbs.*;
import gplx.dbs.diffs.itms.*;
import gplx.dbs.diffs.builds.*;
public class Gdif_core {
private final Db_conn conn;
private final Gdif_job_tbl job_tbl;
private final Gdif_cmd_tbl cmd_tbl;
private final Gdif_txn_tbl txn_tbl;
private final Db_conn conn;
private final Gdif_job_tbl job_tbl;
private final Gdif_cmd_tbl cmd_tbl;
private final Gdif_txn_tbl txn_tbl;
public Gdif_core(Db_conn conn) {
this.conn = conn;
this.db = new Gdif_db(conn);
@@ -30,10 +30,10 @@ public class Gdif_core {
this.cmd_tbl = db.Cmd_tbl();
this.txn_tbl = db.Txn_tbl();
}
public Gdif_db Db() {return db;} private final Gdif_db db;
public Gdif_db Db() {return db;} private final Gdif_db db;
public Gdif_job_itm New_job(String name, String made_by) {
int job_id = conn.Sys_mgr().Autonum_next(job_tbl.Tbl_name(), job_tbl.Fld_job_id());
return job_tbl.Insert(job_id, name, made_by, DateAdp_.Now().XtoUtc(), "");
return job_tbl.Insert(job_id, name, made_by, Datetime_now.Get().XtoUtc(), "");
}
public Gdif_cmd_itm New_cmd(Gdif_bldr_ctx ctx, int tid) {
ctx.Cur_cmd_count++;

View File

@@ -57,7 +57,7 @@ public class Db_cmd_backup implements Gfo_invk {
return this;
}
@gplx.Internal protected Db_cmd_backup InitVars() {
String dteStr = DateAdp_.Now().XtoStr_fmt(dteFmt);
String dteStr = Datetime_now.Get().XtoStr_fmt(dteFmt);
bkpFilName = String_.Format(bkpFilNameFmt, dbName, dteStr);
bkpFil = bkpDir.GenSubFil(bkpFilName);
cmdText = String_.Format("\"{0}\" -u {1} -p{2} {3} > {4}", exeUrl.Xto_api(), usr, pwd, dbName, bkpFil.Xto_api());

View File

@@ -19,7 +19,7 @@ package gplx.dbs.utls; import gplx.*; import gplx.dbs.*;
import org.junit.*;
public class Db_cmd_backup_tst {
@Test public void Basic() {
Tfds.Now_enabled_y_();
Datetime_now.Manual_y_();
Db_cmd_backup bkpWkr = Db_cmd_backup.new_()
.ExeUrl_(Io_url_.new_any_("C:\\mysql\\mysqldump.exe"))
.BkpDir_(Io_url_.new_any_("C:\\bkp\\"))