![](/Images/OutliningIndicators/ContractedBlock.gif)
cs_GetTotalPostCount
ALTER PROCEDURE [dbo].cs_GetTotalPostCount
(
@SettingsID int
)
![](/Images/OutliningIndicators/None.gif)
AS
SET Transaction Isolation Level Read UNCOMMITTED
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
/**//*设置事务隔离级别,Read UNCOMMITTED 执行脏读或 0 级隔离锁定,这表示不发出共享锁,
也不接受排它锁。当设置该选项时,可以对数据执行未提交读或脏读;在事务结束前可以更
改数据内的数值,行也可以出现在数据集中或从数据集消失。该选项的作用与在事务内所有
语句中的所有表上设置 NOLOCK 相同。这是四个隔离级别中限制最小的级别。*/
![](/Images/OutliningIndicators/None.gif)
SELECT TOP 1
TotalPosts
FROM
forums_Statistics where SettingsID = @SettingsID
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
/**//*我在数据库里好象没看过这张表*/
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/ContractedBlock.gif)
cs_GetSectionSubscriptionTypes
ALTER procedure [dbo].cs_GetSectionSubscriptionTypes
(
@UserID int,
@SettingsID int
)
AS
SET Transaction Isolation Level Read UNCOMMITTED
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
/**//*设置事务隔离级别,Read UNCOMMITTED 执行脏读或 0 级隔离锁定,这表示不发出共享锁,
也不接受排它锁。当设置该选项时,可以对数据执行未提交读或脏读;在事务结束前可以更
改数据内的数值,行也可以出现在数据集中或从数据集消失。该选项的作用与在事务内所有
语句中的所有表上设置 NOLOCK 相同。这是四个隔离级别中限制最小的级别。*/
![](/Images/OutliningIndicators/None.gif)
SELECT SubscriptionType, SectionID FROM cs_TrackedSections WHERE UserID=@UserID and SettingsID = @SettingsID
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
/**//*获取某用户的所有订阅*/
![](/Images/OutliningIndicators/ContractedBlock.gif)
cs_GetAnonymousUserID
ALTER Proc [dbo].cs_GetAnonymousUserID
(
@SettingsID int,
@UserID int output
)
as
SET Transaction Isolation Level Read UNCOMMITTED
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
/**//*设置事务隔离级别,Read UNCOMMITTED 执行脏读或 0 级隔离锁定,这表示不发出共享锁,
也不接受排它锁。当设置该选项时,可以对数据执行未提交读或脏读;在事务结束前可以更
改数据内的数值,行也可以出现在数据集中或从数据集消失。该选项的作用与在事务内所有
语句中的所有表上设置 NOLOCK 相同。这是四个隔离级别中限制最小的级别。*/
![](/Images/OutliningIndicators/None.gif)
Select @UserID = cs_UserID FROM cs_vw_Users_FullUser where SettingsID = @SettingsID and IsAnonymous = 1
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
/**//*获取匿名用户的ID*/
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/ContractedBlock.gif)
cs_gallery_Search_PostReindex
ALTER PROCEDURE dbo.cs_gallery_Search_PostReindex
(
@RowCount int,
@SettingsID int
)
AS
SET Transaction Isolation Level Read UNCOMMITTED
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
/**//*设置事务隔离级别,Read UNCOMMITTED 执行脏读或 0 级隔离锁定,这表示不发出共享锁,
也不接受排它锁。当设置该选项时,可以对数据执行未提交读或脏读;在事务结束前可以更
改数据内的数值,行也可以出现在数据集中或从数据集消失。该选项的作用与在事务内所有
语句中的所有表上设置 NOLOCK 相同。这是四个隔离级别中限制最小的级别。*/
![](/Images/OutliningIndicators/None.gif)
SET ROWCOUNT @RowCount
![](/Images/OutliningIndicators/None.gif)
SELECT
T.*,
SortOrder = 1,
P.PostID,
P.ParentID,
P.Subject,
P.Body,
P.FormattedBody,
P.PostLevel, P.PostName, P.ApplicationPostType, P.UserTime,
P.PostPropertyNames as PostPropertyNames, P.PostPropertyValues as PostPropertyValues,
P.Points as PostPoints,
Username = P.PostAuthor, P.UserID,
P.PostConfiguration,
AttachmentFilename,ContentType, IsRemote, [Height], [Width], FriendlyFileName, ContentSize, [FileName],p.Created,
-- AttachmentFilename = ISNULL ( (SELECT [FileName] FROM cs_PostAttachments WHERE PostID = P.PostID), ''),
Replies = (SELECT COUNT(P2.PostID) FROM cs_Posts P2 (nolock) WHERE P2.ParentID = P.PostID AND P2.PostLevel != 1)
FROM
cs_vw_PostsWithAttachmentDetails P (nolock),
-- cs_Posts P (nolock),
cs_Threads T,
cs_Sections F
WHERE
F.SectionID = P.SectionID AND
F.IsActive = 1 AND
F.IsSearchable = 1 AND
P.IsApproved = 1 AND
T.ThreadID = P.ThreadID and
P.IsIndexed = 0 and
F.SettingsID = @SettingsID and
F.ApplicationType = 2 AND
P.PostLevel = 1
ORDER BY
T.ThreadDate DESC
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/ContractedBlock.gif)
cs_GetSectionSubscriptionType
ALTER procedure [dbo].cs_GetSectionSubscriptionType
(
@UserID int,
@SectionID int,
@SettingsID int,
@SubType int OUTPUT
)
AS
SET Transaction Isolation Level Read UNCOMMITTED
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
/**//*设置事务隔离级别,Read UNCOMMITTED 执行脏读或 0 级隔离锁定,这表示不发出共享锁,
也不接受排它锁。当设置该选项时,可以对数据执行未提交读或脏读;在事务结束前可以更
改数据内的数值,行也可以出现在数据集中或从数据集消失。该选项的作用与在事务内所有
语句中的所有表上设置 NOLOCK 相同。这是四个隔离级别中限制最小的级别。*/
![](/Images/OutliningIndicators/None.gif)
SELECT SubscriptionType FROM cs_TrackedSections WHERE SectionID=@SectionID AND UserID=@UserID and SettingsID = @SettingsID
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
/**//*获取某版块/博客的订阅类型*/
![](/Images/OutliningIndicators/None.gif)
posted on
2006-09-20 15:57
MainIsUsed
阅读(
192)
评论()
编辑
收藏
举报