cs_Favorites_GetSections
ALTER procedure dbo.cs_Favorites_GetSections
(
@UserID int,
@SettingsID int
)
AS
SET Transaction Isolation Level Read UNCOMMITTED
/**//*设置事务隔离级别,Read UNCOMMITTED 执行脏读或 0 级隔离锁定,这表示不发出共享锁,
也不接受排它锁。当设置该选项时,可以对数据执行未提交读或脏读;在事务结束前可以更
改数据内的数值,行也可以出现在数据集中或从数据集消失。该选项的作用与在事务内所有
语句中的所有表上设置 NOLOCK 相同。这是四个隔离级别中限制最小的级别。*/
SELECT
F.SectionID,
F.ApplicationType
FROM
cs_FavoriteSections F
WHERE
F.OwnerID = @UserID AND
F.SettingsID = @SettingsID
/**//*因为版块的信息没帖子那么多,也没放在视图里,所以,还好,字段挺少的.*/
GO
ALTER procedure dbo.cs_Favorites_GetSections
(
@UserID int,
@SettingsID int
)
AS
SET Transaction Isolation Level Read UNCOMMITTED
/**//*设置事务隔离级别,Read UNCOMMITTED 执行脏读或 0 级隔离锁定,这表示不发出共享锁,
也不接受排它锁。当设置该选项时,可以对数据执行未提交读或脏读;在事务结束前可以更
改数据内的数值,行也可以出现在数据集中或从数据集消失。该选项的作用与在事务内所有
语句中的所有表上设置 NOLOCK 相同。这是四个隔离级别中限制最小的级别。*/
SELECT
F.SectionID,
F.ApplicationType
FROM
cs_FavoriteSections F
WHERE
F.OwnerID = @UserID AND
F.SettingsID = @SettingsID
/**//*因为版块的信息没帖子那么多,也没放在视图里,所以,还好,字段挺少的.*/
GO
cs_Favorites_Get
ALTER procedure dbo.cs_Favorites_Get
(
@FavoriteType int,
@UserID int,
@SettingsID int
)
AS
SET Transaction Isolation Level Read UNCOMMITTED
/**//*设置事务隔离级别,Read UNCOMMITTED 执行脏读或 0 级隔离锁定,这表示不发出共享锁,
也不接受排它锁。当设置该选项时,可以对数据执行未提交读或脏读;在事务结束前可以更
改数据内的数值,行也可以出现在数据集中或从数据集消失。该选项的作用与在事务内所有
语句中的所有表上设置 NOLOCK 相同。这是四个隔离级别中限制最小的级别。*/
----------------------------------------------------------------------------
/**//*判断类型,然后查询某用户的关注,*/
----------------------------------------------------------------------------
IF @FavoriteType = 1 -- Section
SELECT
F.FavoriteID,
F.OwnerID AS UserID,
F.SettingsID,
F.SectionID AS ItemID,
@FavoriteType AS FavoriteType,
F.ApplicationType
FROM
cs_FavoriteSections F
WHERE
F.OwnerID = @UserID AND
F.SettingsID = @SettingsID
ELSE IF @FavoriteType = 2 -- User
SELECT
F.FavoriteID,
F.OwnerID AS UserID,
F.SettingsID,
F.UserID AS ItemID,
@FavoriteType AS FavoriteType,
F.ApplicationType
FROM
cs_FavoriteUsers F
WHERE
F.OwnerID = @UserID AND
F.SettingsID = @SettingsID
ELSE IF @FavoriteType = 4 -- Post
SELECT
F.FavoriteID,
F.OwnerID AS UserID,
F.SettingsID,
F.PostID AS ItemID,
@FavoriteType AS FavoriteType,
F.ApplicationType
FROM
cs_FavoritePosts F
WHERE
F.OwnerID = @UserID AND
F.SettingsID = @SettingsID
GO
ALTER procedure dbo.cs_Favorites_Get
(
@FavoriteType int,
@UserID int,
@SettingsID int
)
AS
SET Transaction Isolation Level Read UNCOMMITTED
/**//*设置事务隔离级别,Read UNCOMMITTED 执行脏读或 0 级隔离锁定,这表示不发出共享锁,
也不接受排它锁。当设置该选项时,可以对数据执行未提交读或脏读;在事务结束前可以更
改数据内的数值,行也可以出现在数据集中或从数据集消失。该选项的作用与在事务内所有
语句中的所有表上设置 NOLOCK 相同。这是四个隔离级别中限制最小的级别。*/
----------------------------------------------------------------------------
/**//*判断类型,然后查询某用户的关注,*/
----------------------------------------------------------------------------
IF @FavoriteType = 1 -- Section
SELECT
F.FavoriteID,
F.OwnerID AS UserID,
F.SettingsID,
F.SectionID AS ItemID,
@FavoriteType AS FavoriteType,
F.ApplicationType
FROM
cs_FavoriteSections F
WHERE
F.OwnerID = @UserID AND
F.SettingsID = @SettingsID
ELSE IF @FavoriteType = 2 -- User
SELECT
F.FavoriteID,
F.OwnerID AS UserID,
F.SettingsID,
F.UserID AS ItemID,
@FavoriteType AS FavoriteType,
F.ApplicationType
FROM
cs_FavoriteUsers F
WHERE
F.OwnerID = @UserID AND
F.SettingsID = @SettingsID
ELSE IF @FavoriteType = 4 -- Post
SELECT
F.FavoriteID,
F.OwnerID AS UserID,
F.SettingsID,
F.PostID AS ItemID,
@FavoriteType AS FavoriteType,
F.ApplicationType
FROM
cs_FavoritePosts F
WHERE
F.OwnerID = @UserID AND
F.SettingsID = @SettingsID
GO