DoEscapeString() public static method

public static DoEscapeString ( string input ) : string
input string
return string
Ejemplo n.º 1
0
        public static bool SaveUserCacheData(int user, string cacheName, byte[] data, long cacheTime, string username, int ownerType)
        {
            // First of all convert the cache data into a string
            char[] cData = new char[data.Length];

            for (int i = 0; i < data.Length; i++)
            {
                cData[i] = (char)data[i];
            }

            string cacheData = new string(cData);

            uint version = Crc32.Checksum(data);

            string query = "DELETE FROM usercache WHERE cacheType='" + cacheName + "'";

            Database.Query(query);
            query = "INSERT INTO usercache(cacheType, cacheOwner, cacheOwnerName, cacheOwnerType, cacheData, cacheTime, nodeID, version)VALUES('" + cacheName + "', " + user + ", '" + username + "', " + ownerType + ", '" + Database.DoEscapeString(cacheData) + "', " + cacheTime + ", " + Program.NodeID + ", " + version + ");";

            if (Database.Query(query) == false)
            {
                Log.Error("CacheDB", "Cannot insert cache data for cache " + cacheName);
                return(false);
            }

            return(true);
        }
Ejemplo n.º 2
0
        public static bool SaveCacheData(string cacheName, byte[] data, long cacheTime)
        {
            // First of all convert the cache data into a string
            char[] cData = Encoding.ASCII.GetChars(data);

            string cacheData = new string(cData);

            uint version = Crc32.Checksum(data);

            string query = "DELETE FROM cacheinfo WHERE cacheName='" + cacheName + "'";

            Database.Query(query);
            query = "INSERT INTO cacheinfo(cacheName, cacheData, cacheTime, nodeID, version)VALUES('" + cacheName + "', '" + Database.DoEscapeString(cacheData) + "', " + cacheTime + ", " + Program.NodeID + ", " + version + ");";

            if (Database.Query(query) == false)
            {
                Log.Error("CacheDB", "Cannot insert cache data for cache " + cacheName);
                return(false);
            }

            return(true);
        }