cs_Emails_TrackingSection
ALTER PROCEDURE [dbo].cs_Emails_TrackingSection
(
@PostID INT,
@SettingsID int
)
AS
SET Transaction Isolation Level Read UNCOMMITTED
/**//*设置事务隔离级别,Read UNCOMMITTED 执行脏读或 0 级隔离锁定,这表示不发出共享锁,
也不接受排它锁。当设置该选项时,可以对数据执行未提交读或脏读;在事务结束前可以更
改数据内的数值,行也可以出现在数据集中或从数据集消失。该选项的作用与在事务内所有
语句中的所有表上设置 NOLOCK 相同。这是四个隔离级别中限制最小的级别。*/
DECLARE @SectionID INT
DECLARE @UserID INT
DECLARE @PostLevel INT
DECLARE @ThreadID INT
-- First get the post info
--首先获取帖子信息
SELECT
@SectionID = SectionID,
@UserID = UserID,
@PostLevel = PostLevel,
@ThreadID = ThreadID
FROM
cs_Posts (nolock)
WHERE
PostID = @PostID and SettingsID = @SettingsID
-- Check if its a new thread or not
--检查是否是一个新的主题
IF (@PostLevel = 1)
BEGIN
-- this is a new thread (1 & 2)
--1表示主题
-- Check if this is a PM message
--检查是否是个个人消息
IF (@SectionID = 0)
BEGIN
-- we have to bind to the PM users for this ThreadID
SELECT
U.cs_UserID as UserID,
U.Email,
U.EnableHtmlEmail,
F.SubscriptionType
FROM
cs_TrackedSections F
JOIN cs_vw_Users_FullUser U (nolock) ON U.cs_UserID = F.UserID
JOIN cs_PrivateMessages PM ON PM.UserID = F.UserID AND PM.ThreadID = @ThreadID
WHERE
F.SectionID IN (-1, 0) AND F.SettingsID = @SettingsID and U.SettingsID = @SettingsID and
F.SubscriptionType & 3 <> 0
END
ELSE BEGIN
SELECT
U.cs_UserID as UserID,
U.Email,
U.EnableHtmlEmail,
F.SubscriptionType
FROM
cs_TrackedSections F
JOIN cs_vw_Users_FullUser U (nolock) ON U.cs_UserID = F.UserID
WHERE
F.SectionID = @SectionID AND F.SettingsID = @SettingsID and U.SettingsID = @SettingsID and
F.SubscriptionType & 3 <> 0
END
END
ELSE BEGIN
-- this is a reply to an existing post (2)
--这是一个对帖子的回复,2表示回复的
-- Check if this is a PM message
IF (@SectionID = 0)
BEGIN
-- we have to bind to the PM users for this ThreadID
SELECT
U.cs_UserID as UserID,
U.Email,
U.EnableHtmlEmail,
F.SubscriptionType
FROM
cs_TrackedSections F
JOIN cs_vw_Users_FullUser U (nolock) ON U.cs_UserID = F.UserID
JOIN cs_PrivateMessages PM ON PM.UserID = F.UserID AND PM.ThreadID = @ThreadID
WHERE
F.SectionID IN (-1, 0) AND U.SettingsID = @SettingsID and F.SettingsID = @SettingsID and
F.SubscriptionType & 3 = 3
END
ELSE BEGIN
SELECT
U.cs_UserID as UserID,
U.Email,
U.EnableHtmlEmail,
F.SubscriptionType
FROM
cs_TrackedSections F
JOIN cs_vw_Users_FullUser U (nolock) ON U.cs_UserID = F.UserID
WHERE
F.SectionID = @SectionID AND U.SettingsID = @SettingsID and F.SettingsID = @SettingsID and
F.SubscriptionType & 3 = 3
END
END
GO
ALTER PROCEDURE [dbo].cs_Emails_TrackingSection
(
@PostID INT,
@SettingsID int
)
AS
SET Transaction Isolation Level Read UNCOMMITTED
/**//*设置事务隔离级别,Read UNCOMMITTED 执行脏读或 0 级隔离锁定,这表示不发出共享锁,
也不接受排它锁。当设置该选项时,可以对数据执行未提交读或脏读;在事务结束前可以更
改数据内的数值,行也可以出现在数据集中或从数据集消失。该选项的作用与在事务内所有
语句中的所有表上设置 NOLOCK 相同。这是四个隔离级别中限制最小的级别。*/
DECLARE @SectionID INT
DECLARE @UserID INT
DECLARE @PostLevel INT
DECLARE @ThreadID INT
-- First get the post info
--首先获取帖子信息
SELECT
@SectionID = SectionID,
@UserID = UserID,
@PostLevel = PostLevel,
@ThreadID = ThreadID
FROM
cs_Posts (nolock)
WHERE
PostID = @PostID and SettingsID = @SettingsID
-- Check if its a new thread or not
--检查是否是一个新的主题
IF (@PostLevel = 1)
BEGIN
-- this is a new thread (1 & 2)
--1表示主题
-- Check if this is a PM message
--检查是否是个个人消息
IF (@SectionID = 0)
BEGIN
-- we have to bind to the PM users for this ThreadID
SELECT
U.cs_UserID as UserID,
U.Email,
U.EnableHtmlEmail,
F.SubscriptionType
FROM
cs_TrackedSections F
JOIN cs_vw_Users_FullUser U (nolock) ON U.cs_UserID = F.UserID
JOIN cs_PrivateMessages PM ON PM.UserID = F.UserID AND PM.ThreadID = @ThreadID
WHERE
F.SectionID IN (-1, 0) AND F.SettingsID = @SettingsID and U.SettingsID = @SettingsID and
F.SubscriptionType & 3 <> 0
END
ELSE BEGIN
SELECT
U.cs_UserID as UserID,
U.Email,
U.EnableHtmlEmail,
F.SubscriptionType
FROM
cs_TrackedSections F
JOIN cs_vw_Users_FullUser U (nolock) ON U.cs_UserID = F.UserID
WHERE
F.SectionID = @SectionID AND F.SettingsID = @SettingsID and U.SettingsID = @SettingsID and
F.SubscriptionType & 3 <> 0
END
END
ELSE BEGIN
-- this is a reply to an existing post (2)
--这是一个对帖子的回复,2表示回复的
-- Check if this is a PM message
IF (@SectionID = 0)
BEGIN
-- we have to bind to the PM users for this ThreadID
SELECT
U.cs_UserID as UserID,
U.Email,
U.EnableHtmlEmail,
F.SubscriptionType
FROM
cs_TrackedSections F
JOIN cs_vw_Users_FullUser U (nolock) ON U.cs_UserID = F.UserID
JOIN cs_PrivateMessages PM ON PM.UserID = F.UserID AND PM.ThreadID = @ThreadID
WHERE
F.SectionID IN (-1, 0) AND U.SettingsID = @SettingsID and F.SettingsID = @SettingsID and
F.SubscriptionType & 3 = 3
END
ELSE BEGIN
SELECT
U.cs_UserID as UserID,
U.Email,
U.EnableHtmlEmail,
F.SubscriptionType
FROM
cs_TrackedSections F
JOIN cs_vw_Users_FullUser U (nolock) ON U.cs_UserID = F.UserID
WHERE
F.SectionID = @SectionID AND U.SettingsID = @SettingsID and F.SettingsID = @SettingsID and
F.SubscriptionType & 3 = 3
END
END
GO
cs_Emails_TrackingThread
ALTER PROCEDURE [dbo].cs_Emails_TrackingThread
(
@PostID INT,
@SettingsID int
)
AS
SET Transaction Isolation Level Read UNCOMMITTED
/**//*设置事务隔离级别,Read UNCOMMITTED 执行脏读或 0 级隔离锁定,这表示不发出共享锁,
也不接受排它锁。当设置该选项时,可以对数据执行未提交读或脏读;在事务结束前可以更
改数据内的数值,行也可以出现在数据集中或从数据集消失。该选项的作用与在事务内所有
语句中的所有表上设置 NOLOCK 相同。这是四个隔离级别中限制最小的级别。*/
DECLARE @SectionID INT
DECLARE @UserID INT
DECLARE @PostLevel INT
DECLARE @ThreadID INT
-- First get the post info
--首先获取帖子信息
SELECT
@SectionID = SectionID,
@UserID = UserID,
@PostLevel = PostLevel,
@ThreadID = ThreadID
FROM
cs_Posts (nolock)
WHERE
PostID = @PostID and SettingsID = @SettingsID
-- Check if this is a PM message
--检查是否是个人信息
IF (@SectionID = 0)
BEGIN
-- we have to bind to the PM users for this ThreadID
SELECT
U.cs_UserID as UserID,
U.Email,
U.EnableHtmlEmail
FROM
cs_TrackedThreads T
JOIN cs_vw_Users_FullUser U (nolock) ON U.cs_UserID = T.UserID
JOIN cs_PrivateMessages PM ON PM.UserID = T.UserID AND PM.ThreadID = @ThreadID
WHERE
T.ThreadID = @ThreadID and T.SettingsID = @SettingsID and U.SettingsID = @SettingsID and PM.SettingsID = @SettingsID
END
ELSE BEGIN
SELECT
U.cs_UserID as UserID,
U.Email,
U.EnableHtmlEmail
FROM
cs_TrackedThreads T
JOIN cs_vw_Users_FullUser U (nolock) ON U.cs_UserID = T.UserID
WHERE
T.ThreadID = @ThreadID and T.SettingsID = @SettingsID and U.SettingsID = @SettingsID
END
GO
ALTER PROCEDURE [dbo].cs_Emails_TrackingThread
(
@PostID INT,
@SettingsID int
)
AS
SET Transaction Isolation Level Read UNCOMMITTED
/**//*设置事务隔离级别,Read UNCOMMITTED 执行脏读或 0 级隔离锁定,这表示不发出共享锁,
也不接受排它锁。当设置该选项时,可以对数据执行未提交读或脏读;在事务结束前可以更
改数据内的数值,行也可以出现在数据集中或从数据集消失。该选项的作用与在事务内所有
语句中的所有表上设置 NOLOCK 相同。这是四个隔离级别中限制最小的级别。*/
DECLARE @SectionID INT
DECLARE @UserID INT
DECLARE @PostLevel INT
DECLARE @ThreadID INT
-- First get the post info
--首先获取帖子信息
SELECT
@SectionID = SectionID,
@UserID = UserID,
@PostLevel = PostLevel,
@ThreadID = ThreadID
FROM
cs_Posts (nolock)
WHERE
PostID = @PostID and SettingsID = @SettingsID
-- Check if this is a PM message
--检查是否是个人信息
IF (@SectionID = 0)
BEGIN
-- we have to bind to the PM users for this ThreadID
SELECT
U.cs_UserID as UserID,
U.Email,
U.EnableHtmlEmail
FROM
cs_TrackedThreads T
JOIN cs_vw_Users_FullUser U (nolock) ON U.cs_UserID = T.UserID
JOIN cs_PrivateMessages PM ON PM.UserID = T.UserID AND PM.ThreadID = @ThreadID
WHERE
T.ThreadID = @ThreadID and T.SettingsID = @SettingsID and U.SettingsID = @SettingsID and PM.SettingsID = @SettingsID
END
ELSE BEGIN
SELECT
U.cs_UserID as UserID,
U.Email,
U.EnableHtmlEmail
FROM
cs_TrackedThreads T
JOIN cs_vw_Users_FullUser U (nolock) ON U.cs_UserID = T.UserID
WHERE
T.ThreadID = @ThreadID and T.SettingsID = @SettingsID and U.SettingsID = @SettingsID
END
GO