Cs_folder_getfeeds
Alter proc [DBO]. cs_folder_getfeeds
@ Userid int,
@ Settingsid int,
@ Folderid Int = NULL
As
/** // * If it is null, run the following query. If it is not null, run the following query. It seems that nothing is said, omitted ............ */
If (@ folderid is null)
Begin
Select cf1.feedid,
Cf1.url,
Cf1.title,
Cf1.link,
Cf1.etag,
Cf1.lastmodified,
Cf1.language,
Cf1.generator,
Cf1.subscribedate,
Cf1.lastupdatedate,
Cf1.feedstateid,
CFF. folderfeedid
, [Unreadcount] = (select count (*) from (select top 50 F. feedpostid, F. feedid from cs_feedpost f Where F. feedid = cf1.feedid order by pubdate DESC) FP left Outer Join cs_userreadpost URP on FP. feedpostid = Urp. feedpostid where FP. feedid = CFF. feedid and Urp. userid is null)
From cs_feed as CF1,
Cs_folderfeed as CFF
Where CFF. feedid = cf1.feedid
And CFF. userid = @ userid
And CFF. folderid is null
And cf1.settingsid = @ settingsid
Order by cf1.title
End
Else
Begin
Select cf1.feedid,
Cf1.url,
Cf1.title,
Cf1.link,
Cf1.language,
Cf1.generator,
Cf1.etag,
Cf1.lastmodified,
Cf1.subscribedate,
Cf1.lastupdatedate,
Cf1.feedstateid,
CFF. folderfeedid
, [Unreadcount] = (select count (*) from (select top 50 F. feedpostid, F. feedid from cs_feedpost f Where F. feedid = cf1.feedid order by pubdate DESC) FP left Outer Join cs_userreadpost URP on FP. feedpostid = Urp. feedpostid where FP. feedid = CFF. feedid and Urp. userid is null)
From cs_feed as CF1,
Cs_folderfeed as CFF
Where CFF. feedid = cf1.feedid
And CFF. userid = @ userid
And CFF. folderid = @ folderid
And cf1.settingsid = @ settingsid
Order by cf1.title
End
Cs_folder_deletefolder
Alter proc [DBO]. cs_folder_deletefolder
@ Folderid int
As
-- First, let's delete any associated feeds.
-- Delete records in the joined table first
Delete
From cs_folderfeed
Where folderid = @ folderid
-- Now, delete the folder.
-- Delete the records of the master table.
Delete
From cs_folder
Where folderid = @ folderid
Cs_folder_addfolder
Alter proc [DBO]. cs_folder_addfolder
@ Userid int,
@ Foldername nvarchar (50 ),
@ Parentfolderid Int = NULL,
@ Settingsid int,
@ Folderid int output
As
/** // * Add the record and return the ID */
Insert into cs_folder
(
Userid,
Foldername,
Parentfolderid,
Settingsid
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.