//TMonitorLog public static SUpdate GetTimeForGame(string SearchExt) { using (var cn = new MySqlConnection(sqlconnectionString)) { cn.Open(); StringBuilder str = new StringBuilder(); str.Append("select * from " + database3 + @".S_Update where UpdateTable = '" + SearchExt + "'"); IEnumerable <SUpdate> i = cn.Query <SUpdate>(str.ToString()); cn.Close(); SUpdate mode = i.FirstOrDefault(); if (mode == null) { DateTime dtN = GetDataBaseTime(); string sql = @" insert into " + database3 + @".S_Update(CountDate,UpdateTable,id_date,Description) VALUES('" + dtN + "', '" + SearchExt + "','" + dtN + "', '');"; cn.Execute(sql); return(new SUpdate() { CountDate = dtN, id_date = dtN });; //主动添加 } return(mode); } }
public SDatabase Install(SUpdate u, long c) { var obs = objects; var st = ((STable)obs[u.table]) + u; SRecord?sr = null; if (u.uid >= STransaction._uid) { obs += (u.uid, u); } obs += (u.table, st); var nms = names + (st.name, st); for (var b = st.indexes.First(); b != null; b = b.Next()) { var x = (SIndex)obs[b.Value.Item1]; if (sr == null) { sr = Get(u.defpos); } obs += (x.uid, x.Update(sr, u, c)); if (x.references == u.table && !x.Contains(u)) { throw new Exception("Referential constraint"); } } return(New(obs, nms, c)); }
public void ThreadProc() { while (true) { string execSql = ""; //这里就是要执行的任务,本处只显示一下传入的参数 foreach (var item in TMonitorDatas) { //SafeBoxSet SUpdate times = TimerBLL.GetTimeForGame(item.UpdateTable); string sql = item.ExecSQL.Replace("@StartDate", "'" + times.CountDate + "'") .Replace("@EndDate", "'" + times.id_date + "'"); //修改时间 sql = sql + "update record.S_Update set CountDate='" + times.id_date + "' , id_date=now() where UpdateTable='" + item.UpdateTable + "';"; execSql += sql; } int i = TimerBLL.ExecuteSql(execSql); Thread.Sleep(TMonitorDatas[0].ExecType * 60 * 1000); } }
internal static SUpdate GetBeginTimeForGame(GameRecordView vbd) { using (var cn = new MySqlConnection(sqlconnectionString)) { cn.Open(); StringBuilder str = new StringBuilder(); str.Append("select * from S_Update where UpdateTable = '" + vbd.SearchExt + "'"); IEnumerable <SUpdate> i = cn.Query <SUpdate>(str.ToString()); cn.Close(); SUpdate mode = i.FirstOrDefault(); //if (mode == null) { // return vbd.ExpirationDate; //} //return mode.id_date.ToString(); return(mode); } }