![](/Images/OutliningIndicators/ContractedBlock.gif)
cs_Feed_GetFeedPosts
ALTER PROC [dbo].cs_Feed_GetFeedPosts --引用帖子
@FeedId INT,
@UserId INT,
@SettingsID INT
AS
![](/Images/OutliningIndicators/None.gif)
SELECT top 50 fp.FeedPostId,
fp.FeedId,
fp.Author,
fp.Title,
fp.Description,
fp.Source,
fp.GuidName,
fp.GuidIsPermaLink,
fp.Link,
fp.PubDate,
fp.CommentsUrl,
fp.EnclosureUrl,
fp.EnclosureLength,
fp.EnclosureType,
fp.Creator,
fp.CommentApiUrl,
fp.CommentRssUrl,
fp.CommentCount,
HasRead = CASE WHEN urp.UserID
IS NULL THEN 0 ELSE 1
END
FROM
(SELECT DISTINCT UserID, FeedID FROM cs_FolderFeed) ff
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
/**//*这相当于临时表*/
INNER JOIN cs_Feed f ON
ff.FeedId = f.FeedId
INNER JOIN cs_FeedPost fp ON
ff.FeedId = fp.FeedId
LEFT OUTER JOIN cs_UserReadPost urp ON
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
/**//*Left Outer Join 逻辑运算符返回每个满足第一个(顶端)输入与第二个(底端)输入的联接的行。
它还返回任何在第二个输入中没有匹配行的第一个输入中的行。第二个输入中的非匹配行作为空值返回。
如果 Argument 列内不存在任何联接谓词,则每行都是一个匹配行。*/
fp.FeedPostId = urp.FeedPostId
AND ff.UserID = urp.UserID
WHERE
ff.UserID = @UserId and f.SettingsID = @SettingsID
AND
ff.FeedId = @FeedId
ORDER BY fp.PubDate DESC
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/ContractedBlock.gif)
cs_Feed_GetAll_ModifiedSince
ALTER PROC [dbo].cs_Feed_GetAll_ModifiedSince
(
@Minutes int,
@SettingsID int
)
AS
![](/Images/OutliningIndicators/None.gif)
SELECT FeedId,
Url,
Title,
Link,
Language,
Generator,
SubscribeDate,
LastUpdateDate,
FeedStateId,
LastModified,
ETag
FROM cs_Feed
Where DateAdd(mi, @Minutes, LastUpdateDate) <= GetDate() and SettingsID = @SettingsID
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
/**//*DATEADD在向指定日期加上一段时间的基础上,返回新的 datetime 值。
GETDATE按 datetime 值的 Microsoft? SQL Server? 标准内部格式返回当前系统日期和时间。*/
-------------------------------------------------------------------------
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
/**//*在最近更新时间的分钟数上递增@Minutes的值,如果小于当前时间,则显示.*/
-------------------------------------------------------------------------
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/ContractedBlock.gif)
cs_Feed_GetFeed
ALTER PROC [dbo].cs_Feed_GetFeed
@FeedId INT
AS
![](/Images/OutliningIndicators/None.gif)
SELECT FeedId,
Url,
Title,
Link,
Language,
Generator,
SubscribeDate,
LastUpdateDate,
FeedStateId,
LastModified,
ETag
FROM cs_Feed
WHERE FeedId = @FeedId
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
/**//*获取指定的引用*/
posted on
2006-09-20 11:30
MainIsUsed
阅读(
198)
评论()
编辑
收藏
举报