public byte[] QueryLiveGSLog(string querysql) { if (GetIP4Address() != GSSServerIP) { string erro = "非法请求,将拒绝对此请求提供服务,请求IP:" + GetIP4Address() + " "; Log.Warn(erro); return(DataSerialize.GetDataSetSurrogateZipBYtes(GetErrorDS(erro))); } if (ConnStrGsLogDB.Trim() == string.Empty) { string erro = "非法请求,将拒绝对此实时请求提供服务"; Log.Warn(erro); return(DataSerialize.GetDataSetSurrogateZipBYtes(GetErrorDS(erro))); } if (!CheckQuerySql(querysql)) { string erro = "非法请求,将拒绝对此实时请求提供服务(SQL)"; Log.Warn(erro); return(DataSerialize.GetDataSetSurrogateZipBYtes(GetErrorDS(erro))); } try { DbHelperMySQLP sp = new DbHelperMySQLP(ConnStrGsLogDB); DataSet ds = sp.Query(querysql); return(DataSerialize.GetDataSetSurrogateZipBYtes(ds)); } catch (System.Exception ex) { string erro = "MYSQL战区日志实时库查询(实时方式)查询操作错误[" + ex.Message + "]"; Log.Error(erro, ex); return(DataSerialize.GetDataSetSurrogateZipBYtes(GetErrorDS(erro))); } }
public List <string> GetAllIds(string strWhere) { StringBuilder strSql = new StringBuilder(); strSql.Append("select id from staff_data "); if (!string.IsNullOrWhiteSpace(strWhere)) { strSql.Append("where " + strWhere); } DataSet ds = DbHelperMySQLP.Query(strSql.ToString()); List <string> list = new List <string>(); if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow item in ds.Tables[0].Rows) { string id = item[0].ToString(); list.Add(id); } } return(list); }