当前位置: 首页>>代码示例>>C#>>正文


C# SqlDatabaseClient.SetParameter方法代码示例

本文整理汇总了C#中Reality.Storage.SqlDatabaseClient.SetParameter方法的典型用法代码示例。如果您正苦于以下问题:C# SqlDatabaseClient.SetParameter方法的具体用法?C# SqlDatabaseClient.SetParameter怎么用?C# SqlDatabaseClient.SetParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Reality.Storage.SqlDatabaseClient的用法示例。


在下文中一共展示了SqlDatabaseClient.SetParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FriendshipExists

        public static bool FriendshipExists(SqlDatabaseClient MySqlClient, uint UserId1, uint UserId2, bool ConfirmedOnly)
        {
            MySqlClient.SetParameter("user1", UserId1);
            MySqlClient.SetParameter("user2", UserId2);
            MySqlClient.SetParameter("confirmed", (ConfirmedOnly ? 0 : 2));

            return (MySqlClient.ExecuteQueryRow("SELECT null FROM messenger_friendships WHERE user_1_id = @user1 AND user_2_id = @user2 AND confirmed != @confirmed OR user_2_id = @user1 AND user_1_id = @user2 AND confirmed != @confirmed LIMIT 1") != null);
        }
开发者ID:DaimOwns,项目名称:ProRP,代码行数:8,代码来源:MessengerHandler.cs

示例2: CreateFriendship

 public static void CreateFriendship(SqlDatabaseClient MySqlClient, uint UserId1, uint UserId2, bool Confirmed)
 {
     for (int i = 0; i < (Confirmed ? 2 : 1); i++)
     {
         MySqlClient.SetParameter("user1", (i == 1 ? UserId1 : UserId2));
         MySqlClient.SetParameter("user2", (i == 1 ? UserId2 : UserId1));
         MySqlClient.SetParameter("accepted", (int)(Confirmed ? 1 : 0));
         MySqlClient.ExecuteNonQuery("INSERT INTO messenger_friendships (user_1_id,user_2_id,confirmed) VALUES (@user1,@user2,@accepted)");
     }
 }
开发者ID:DaimOwns,项目名称:ProRP,代码行数:10,代码来源:MessengerHandler.cs

示例3: DeleteRoom

        public static void DeleteRoom(SqlDatabaseClient MySqlClient, uint RoomId)
        {
            MySqlClient.SetParameter("id", RoomId);
            MySqlClient.ExecuteNonQuery("DELETE FROM rooms WHERE id = @id LIMIT 1");

            MySqlClient.SetParameter("id", RoomId);
            MySqlClient.ExecuteNonQuery("DELETE FROM navigator_frontpage WHERE room_id = @id");

            RoomInfoLoader.RemoveFromCache(RoomId);
            Navigator.ReloadOfficialItems(MySqlClient);
        }
开发者ID:DaimOwns,项目名称:ProRP,代码行数:11,代码来源:RoomManager.cs

示例4: DestroyFriendship

        public static bool DestroyFriendship(SqlDatabaseClient MySqlClient, uint UserId1, uint UserId2)
        {
            int aff = 0;

            for (int i = 0; i < 2; i++)
            {
                MySqlClient.SetParameter("user1", (i == 1 ? UserId1 : UserId2));
                MySqlClient.SetParameter("user2", (i == 1 ? UserId2 : UserId1));
                aff += MySqlClient.ExecuteNonQuery("DELETE FROM messenger_friendships WHERE user_1_id = @user1 AND user_2_id = @user2 LIMIT 1");
            }

            return (aff > 0);
        }
开发者ID:DaimOwns,项目名称:ProRP,代码行数:13,代码来源:MessengerHandler.cs

示例5: BanUser

        public static void BanUser(SqlDatabaseClient MySqlClient, uint UserId, string MessageText, uint ModeratorId, double Length)
        {
            MySqlClient.SetParameter("userid", UserId);
            MySqlClient.SetParameter("reason", MessageText);
            MySqlClient.SetParameter("timestamp", UnixTimestamp.GetCurrent());
            MySqlClient.SetParameter("timestampex", UnixTimestamp.GetCurrent() + Length);
            MySqlClient.SetParameter("moderator", ModeratorId);
            MySqlClient.ExecuteNonQuery("INSERT INTO bans (user_id,reason_text,timestamp_created,timestamp_expire,moderator_id) VALUES (@userid,@reason,@timestamp,@timestampex,@moderator)");

            lock (mSyncRoot)
            {
                mCharacterBlacklist.Add(UserId);
            }
        }
开发者ID:DaimOwns,项目名称:ProRP,代码行数:14,代码来源:ModerationBanManager.cs

示例6: GetFriendsForUser

        public static List<uint> GetFriendsForUser(SqlDatabaseClient MySqlClient, uint UserId, int Confirmed)
        {
            List<uint> Friends = new List<uint>();

            MySqlClient.SetParameter("id", UserId);
            MySqlClient.SetParameter("confirmed", Confirmed);
            DataTable Table = MySqlClient.ExecuteQueryTable("SELECT user_2_id FROM messenger_friendships WHERE user_1_id = @id AND confirmed = @confirmed");

            foreach (DataRow Row in Table.Rows)
            {
                Friends.Add((uint)Row[0]);
            }

            return Friends;
        }
开发者ID:DaimOwns,项目名称:ProRP,代码行数:15,代码来源:MessengerHandler.cs

示例7: GetCharacterInfo

        public static CharacterInfo GetCharacterInfo(SqlDatabaseClient MySqlClient, uint CharacterId, uint LinkedClientId, bool IgnoreCache)
        {
            if (SessionManager.ContainsCharacterId(CharacterId))
            {
                Session Session = SessionManager.GetSessionByCharacterId(CharacterId);
                return Session.CharacterInfo;
            }

            if (!IgnoreCache)
            {
                CharacterInfo CachedInfo = TryGetInfoFromCache(CharacterId);

                if (CachedInfo != null)
                {
                    return CachedInfo;
                }
            }

            MySqlClient.SetParameter("id", CharacterId);
            DataRow Row = MySqlClient.ExecuteQueryRow("SELECT * FROM characters WHERE id = @id LIMIT 1");

            if (Row != null)
            {
                return GenerateCharacterInfoFromRow(MySqlClient, LinkedClientId, Row);
            }

            return null;
        }
开发者ID:DaimOwns,项目名称:ProRP,代码行数:28,代码来源:CharacterInfoLoader.cs

示例8: CreateEffect

        public static AvatarEffect CreateEffect(SqlDatabaseClient MySqlClient, uint UserId, int SpriteId, double Duration)
        {
            MySqlClient.SetParameter("userid", UserId);
            MySqlClient.SetParameter("spriteid", SpriteId);
            MySqlClient.SetParameter("duration", Duration);

            string RawId = MySqlClient.ExecuteScalar("INSERT INTO avatar_effects (user_id,sprite_id,duration) VALUES (@userid,@spriteid,@duration); SELECT LAST_INSERT_ID();").ToString();

            uint Id = 0;
            uint.TryParse(RawId, out Id);

            if (Id == 0)
            {
                return null;
            }

            return new AvatarEffect(Id, SpriteId, Duration, 1, false, 0.0);
        }
开发者ID:BjkGkh,项目名称:BobbaRP,代码行数:18,代码来源:AvatarEffectFactory.cs

示例9: MarkNewItem

        public void MarkNewItem(SqlDatabaseClient MySqlClient, int TabId, uint ItemId, bool SynchronizeDatabase = true)
        {
            lock (mSyncRoot)
            {
                if (!mInner.ContainsKey(TabId))
                {
                    mInner[TabId] = new List<uint>();
                }

                mInner[TabId].Add(ItemId);

                if (SynchronizeDatabase)
                {
                    MySqlClient.SetParameter("userid", mUserId);
                    MySqlClient.SetParameter("tabid", TabId);
                    MySqlClient.SetParameter("itemid", ItemId);
                    MySqlClient.ExecuteNonQuery("INSERT INTO new_items (user_id,tab_id,item_id) VALUES (@userid,@tabid,@itemid)");
                }
            }
        }
开发者ID:BjkGkh,项目名称:BobbaRP,代码行数:20,代码来源:NewItemsCache.cs

示例10: CreatePet

        public static Pet CreatePet(SqlDatabaseClient MySqlClient, uint UserId, int Type, string Name, int Race)
        {
            MySqlClient.SetParameter("userid", UserId);
            MySqlClient.SetParameter("type", Type);
            MySqlClient.SetParameter("name", Name);
            MySqlClient.SetParameter("race", Race);
            MySqlClient.SetParameter("timestamp", UnixTimestamp.GetCurrent());

            string RawId = MySqlClient.ExecuteScalar("INSERT INTO pets (user_id,type,name,race,timestamp) VALUES (@userid,@type,@name,@race,@timestamp); SELECT LAST_INSERT_ID();").ToString();

            uint Id = 0;
            uint.TryParse(RawId, out Id);

            if (Id == 0)
            {
                return null;
            }

            return new Pet(Id, Name, Type, Race, UserId, 0, new Vector3(0, 0, 0), UnixTimestamp.GetCurrent(), 0, 120, 100, 0);
        }
开发者ID:BjkGkh,项目名称:BobbaRP,代码行数:20,代码来源:PetFactory.cs

示例11: AddOrUpdateData

        public void AddOrUpdateData(SqlDatabaseClient MySqlClient, string Group, int Level, int Progress)
        {
            MySqlClient.SetParameter("userid", mUserId);
            MySqlClient.SetParameter("group", Group);
            MySqlClient.SetParameter("level", Level);
            MySqlClient.SetParameter("progress", Progress);

            lock (mSyncRoot)
            {
                if (mInner.ContainsKey(Group))
                {
                    mInner[Group].Level = Level;
                    mInner[Group].Progress = Progress;

                    MySqlClient.ExecuteNonQuery("UPDATE user_achievements SET level = @level, progress = @progress WHERE user_id = @userid AND group_id = @group LIMIT 1");
                }
                else
                {
                    mInner.Add(Group, new UserAchievement(Group, Level, Progress));

                    MySqlClient.ExecuteNonQuery("INSERT INTO user_achievements (user_id,group_id,level,progress) VALUES (@userid,@group,@level,@progress)");
                }
            }
        }
开发者ID:BjkGkh,项目名称:BobbaRP,代码行数:24,代码来源:AchievementCache.cs

示例12: ReloadCache

        public void ReloadCache(SqlDatabaseClient MySqlClient)
        {
            lock (mSyncRoot)
            {
                mInner.Clear();

                MySqlClient.SetParameter("userid", mUserId);
                DataTable Table = MySqlClient.ExecuteQueryTable("SELECT group_id,level,progress FROM user_achievements WHERE user_id = @userid");

                foreach (DataRow Row in Table.Rows)
                {
                    string Group = (string)Row["group_id"];

                    mInner.Add(Group, new UserAchievement(Group, (int)Row["level"], (int)Row["progress"]));
                }
            }
        }
开发者ID:BjkGkh,项目名称:BobbaRP,代码行数:17,代码来源:AchievementCache.cs

示例13: FillCache

        public static void FillCache(SqlDatabaseClient MySqlClient, uint LinkedItemId)
        {
            if (mCache.ContainsKey(LinkedItemId))
            {
                mCache.Remove(LinkedItemId);
            }

            uint IdValue = 0;

            MySqlClient.SetParameter("id", LinkedItemId);
            object Result = MySqlClient.ExecuteScalar("SELECT room_id FROM items WHERE id = @id LIMIT 1");

            if (Result != null)
            {
                IdValue = (uint)Result;
            }

            if (IdValue > 0)
            {
                mCache.Add(LinkedItemId, IdValue);
            }
        }
开发者ID:BjkGkh,项目名称:BobbaRP,代码行数:22,代码来源:TeleporterLinkFinder.cs

示例14: CreateItem

        public static Item CreateItem(SqlDatabaseClient MySqlClient, uint DefinitionId, uint UserId, string Flags, string FlagsDisplay, double ExpireTimestamp, bool Untradable = false, WiredManager WiredManager = null)
        {
            MySqlClient.SetParameter("definitionid", DefinitionId);
            MySqlClient.SetParameter("userid", UserId);
            MySqlClient.SetParameter("flags", Flags);
            MySqlClient.SetParameter("flagsd", FlagsDisplay);
            MySqlClient.SetParameter("untradable", Untradable ? "1" : "0");
            MySqlClient.SetParameter("expiretimestamp", ExpireTimestamp);

            string RawId = MySqlClient.ExecuteScalar("INSERT INTO items (definition_id,user_id,flags,flags_display,untradable,expire_timestamp) VALUES (@definitionid,@userid,@flags,@flagsd,@untradable,@expiretimestamp); SELECT LAST_INSERT_ID();").ToString();

            uint Id = 0;
            uint.TryParse(RawId, out Id);

            if (Id == 0)
            {
                return null;
            }

            return new Item(Id, DefinitionId, UserId, 0, new Vector3(), string.Empty, 0, Flags, Flags, Untradable, 0, 0,
                ExpireTimestamp, WiredManager);
        }
开发者ID:BjkGkh,项目名称:BobbaRP,代码行数:22,代码来源:ItemFactory.cs

示例15: AddOrUpdateData

        public void AddOrUpdateData(SqlDatabaseClient MySqlClient, uint QuestId, int Progress, bool ActiveQuest)
        {
            if (ActiveQuest)
            {
                if (mCurrentQuest > 0)
                {
                    MySqlClient.SetParameter("userid", mUserId);
                    MySqlClient.SetParameter("questid", mCurrentQuest);
                    MySqlClient.ExecuteNonQuery("UPDATE user_quests SET is_current = '0' WHERE user_id = @userid AND quest_id = @questid LIMIT 1");
                }

                mCurrentQuest = QuestId;
            }
            else if (mCurrentQuest == QuestId)
            {
                mCurrentQuest = 0;
            }

            MySqlClient.SetParameter("userid", mUserId);
            MySqlClient.SetParameter("questid", QuestId);
            MySqlClient.SetParameter("progress", Progress);
            MySqlClient.SetParameter("iscurrent", ActiveQuest ? "1" : "0");

            lock (mSyncRoot)
            {
                if (mInner.ContainsKey(QuestId))
                {
                    mInner[QuestId] = Progress;
                    MySqlClient.ExecuteNonQuery("UPDATE user_quests SET progress = @progress, is_current = @iscurrent WHERE user_id = @userid AND quest_id = @questid LIMIT 1");
                }
                else
                {
                    mInner.Add(QuestId, Progress);
                    MySqlClient.ExecuteNonQuery("INSERT INTO user_quests (user_id,quest_id,progress,is_current) VALUES (@userid,@questid,@progress,@iscurrent)");
                }
            }
        }
开发者ID:DaimOwns,项目名称:ProRP,代码行数:37,代码来源:QuestCache.cs


注:本文中的Reality.Storage.SqlDatabaseClient.SetParameter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。