Ejemplo n.º 1
0
 static DBOper()
 {
     LogOutFunc = delegate(string s, int level)
     {
         if (Debug == false && level == 0)
         {
             return(true);
         }
         return(LoginFile.Write(s));
     };
     SpecialList = new List <string>();
     SpecialList.Add(" where ");
     SpecialList.Add("update ");
     SpecialList.Add("select ");
     SpecialList.Add("insert ");
     SpecialList.Add(" form ");
     SpecialList.Add("create ");
     SpecialList.Add("drop ");
     SpecialList.Add("alter ");
     SpecialList.Add(" and ");
     SpecialList.Add(" or ");
     SpecialList.Add(" not ");
     SpecialList.Add(" join ");
     SpecialList.Add(" order ");
     SpecialTextMin = 10000;
     foreach (var item in SpecialList)
     {
         SpecialTextMin = Math.Min(SpecialTextMin, item.Length);
     }
 }
Ejemplo n.º 2
0
        static SJSocket()
        {
            LogHandler = delegate(string s)
            {
                LoginFile.Write(s);
            };
            Func <object> NilHandle = delegate()
            {
                List <string> list = new List <string>();
                list.Add("gameid");
                list.Add("ServerIp");
                list.Add("ServerProt");
                list.Add("ServerName");
                Dictionary <int, Dictionary <string, string> > SQLDBServerInfo;
                bool dbselectres = DBOper.select("SELECT top 1 * FROM DBServerInfo", ref list, out SQLDBServerInfo);
                if (dbselectres == false)
                {
                    return(null);
                }
                else if (SQLDBServerInfo.Count < 1)
                {
                    return(null);
                }
                else
                {
                    return(SQLDBServerInfo[0]);
                }
            };
            Object ODBServerInfo = Tools.InstanceData.get("DBServerInfo", NilHandle);

            if (null == ODBServerInfo)
            {
                throw new Exception("不能获取到ip和port");
            }
            Dictionary <string, string> DBServerInfo = ODBServerInfo as Dictionary <string, string>;

            DefaultIp   = DBServerInfo["ServerIp"];
            DefaultPort = Convert.ToInt32(DBServerInfo["ServerProt"]);
        }