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


C# SqlDatabaseClient.ExecuteNonQuery方法代码示例

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


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

示例1: 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:habb0,项目名称:Snowlight,代码行数:11,代码来源:RoomManager.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,项目名称:Snowlight,代码行数:10,代码来源:MessengerHandler.cs

示例3: 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,项目名称:Snowlight,代码行数:13,代码来源:MessengerHandler.cs

示例4: 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:habb0,项目名称:Snowlight,代码行数:14,代码来源:ModerationBanManager.cs

示例5: 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:habb0,项目名称:Snowlight,代码行数:37,代码来源:QuestCache.cs

示例6: 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:habb0,项目名称:Snowlight,代码行数:24,代码来源:AchievementCache.cs

示例7: SetWardrobeSlot

        public void SetWardrobeSlot(SqlDatabaseClient MySqlClient, int SlotId, string Figure, CharacterGender Gender)
        {
            lock (mWardrobe)
            {
                WardrobeItem Item = new WardrobeItem(Figure, Gender);

                MySqlClient.SetParameter("userid", mId);
                MySqlClient.SetParameter("slotid", SlotId);
                MySqlClient.SetParameter("figure", Figure);
                MySqlClient.SetParameter("gender", Gender == CharacterGender.Male ? "M" : "F");

                if (!mWardrobe.ContainsKey(SlotId))
                {
                    mWardrobe.Add(SlotId, Item);
                    MySqlClient.ExecuteNonQuery("INSERT INTO wardrobe (user_id,slot_id,figure,gender) VALUES (@userid,@slotid,@figure,@gender)");
                    return;
                }

                mWardrobe[SlotId] = Item;
                MySqlClient.ExecuteNonQuery("UPDATE wardrobe SET figure = @figure, gender = @gender WHERE user_id = @userid AND slot_id = @slotid LIMIT 1");
            }
        }
开发者ID:DaimOwns,项目名称:Snowlight,代码行数:22,代码来源:CharacterInfo.cs

示例8: UpdateScore

        public void UpdateScore(SqlDatabaseClient MySqlClient, int Amount)
        {
            mScore += Amount;

            MySqlClient.SetParameter("userid", mId);
            MySqlClient.SetParameter("score", mScore);
            MySqlClient.ExecuteNonQuery("UPDATE characters SET score = @score WHERE id = @userid LIMIT 1");
        }
开发者ID:DaimOwns,项目名称:Snowlight,代码行数:8,代码来源:CharacterInfo.cs

示例9: UpdateMotto

        public void UpdateMotto(SqlDatabaseClient MySqlClient, string NewMotto)
        {
            mMotto = NewMotto;

            MySqlClient.SetParameter("userid", mId);
            MySqlClient.SetParameter("motto", NewMotto);
            MySqlClient.ExecuteNonQuery("UPDATE characters SET motto = @motto WHERE id = @userid LIMIT 1");
        }
开发者ID:DaimOwns,项目名称:Snowlight,代码行数:8,代码来源:CharacterInfo.cs

示例10: UpdateFigure

        public void UpdateFigure(SqlDatabaseClient MySqlClient, string NewGender, string NewFigure)
        {
            mGender = (NewGender == "m" ? CharacterGender.Male : CharacterGender.Female);
            mFigure = NewFigure;

            MySqlClient.SetParameter("userid", mId);
            MySqlClient.SetParameter("figure", mFigure);
            MySqlClient.SetParameter("gender", NewGender);
            MySqlClient.ExecuteNonQuery("UPDATE characters SET gender = @gender, figure = @figure WHERE id = @userid LIMIT 1");
        }
开发者ID:DaimOwns,项目名称:Snowlight,代码行数:10,代码来源:CharacterInfo.cs

示例11: UpdateStatus

        public void UpdateStatus(SqlDatabaseClient MySqlClient, ModerationTicketStatus NewStatus)
        {
            mStatus = NewStatus;

            MySqlClient.SetParameter("id", mId);
            MySqlClient.SetParameter("status", (int)NewStatus);
            MySqlClient.ExecuteNonQuery("UPDATE moderation_tickets SET status = @status WHERE id = @id LIMIT 1");
        }
开发者ID:habb0,项目名称:Snowlight,代码行数:8,代码来源:ModerationTicket.cs

示例12: RemoveTicket

 /// <summary>
 /// Removes the SSO (Single Sign On) ticket from the database after a successful login attempt.
 /// </summary>
 /// <param name="UserId">The character id to remove the ticket from.</param>
 private static void RemoveTicket(SqlDatabaseClient MySqlClient, uint UserId, string AddressToLog)
 {
     MySqlClient.SetParameter("id", UserId);
     MySqlClient.SetParameter("lastip", AddressToLog);
     MySqlClient.SetParameter("lastonline", UnixTimestamp.GetCurrent());
     MySqlClient.ExecuteNonQuery("UPDATE characters SET auth_ticket = '', last_ip = @lastip, timestamp_lastvisit = @lastonline WHERE id = @id LIMIT 1");
 }
开发者ID:DaimOwns,项目名称:Snowlight,代码行数:11,代码来源:SingleSignOnAuthenticator.cs

示例13: SynchronizeDatabase

        public void SynchronizeDatabase(SqlDatabaseClient MySqlClient)
        {
            MySqlClient.SetParameter("id", mItemId);
            MySqlClient.SetParameter("data1", mData1);
            MySqlClient.SetParameter("data2", mData2);
            MySqlClient.SetParameter("data3", mData3);
            MySqlClient.SetParameter("data4", mData4);
            MySqlClient.SetParameter("data5", mData5);
            MySqlClient.SetParameter("time", mTime);

            MySqlClient.ExecuteNonQuery("UPDATE wired_items SET data1 = @data1, data2 = @data2, data3 = @data3, data4 = @data4, data5 = @data5, time = @time WHERE item_id = @id LIMIT 1");
        }
开发者ID:fuding,项目名称:Snowlight,代码行数:12,代码来源:WiredData.cs

示例14: SetLastActivityPointsUpdate

        public void SetLastActivityPointsUpdate(SqlDatabaseClient MySqlClient)
        {
            mTimestampLastActivityPointsUpdate = UnixTimestamp.GetCurrent();

            MySqlClient.SetParameter("id", mId);
            MySqlClient.SetParameter("aplu", mTimestampLastActivityPointsUpdate);
            MySqlClient.ExecuteNonQuery("UPDATE characters SET activity_points_last_update = @aplu WHERE id = @id LIMIT 1");
        }
开发者ID:DaimOwns,项目名称:Snowlight,代码行数:8,代码来源:CharacterInfo.cs

示例15: ApplyDecoration

        public void ApplyDecoration(SqlDatabaseClient MySqlClient, string Key, string Value)
        {
            lock (mSyncRoot)
            {
                if (!mDecorations.ContainsKey(Key))
                {
                    mDecorations.Add(Key, Value);
                }
                else
                {
                    mDecorations[Key] = Value;
                }

                StringBuilder DecorationString = new StringBuilder();

                foreach (KeyValuePair<string, string> Decoration in mDecorations)
                {
                    if (DecorationString.Length > 0)
                    {
                        DecorationString.Append('|');
                    }

                    DecorationString.Append(Decoration.Key);
                    DecorationString.Append('=');
                    DecorationString.Append(Decoration.Value);
                }

                MySqlClient.SetParameter("id", mId);
                MySqlClient.SetParameter("decorations", DecorationString);
                MySqlClient.ExecuteNonQuery("UPDATE rooms SET decorations = @decorations WHERE id = @id LIMIT 1");
            }
        }
开发者ID:habb0,项目名称:Snowlight,代码行数:32,代码来源:RoomInfo.cs


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