Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

Maximum ASP
  Ads  
Aspose - The .NET & Java component publisher
 


  Sponsors  

Meet Our Sponsors

ExactTarget email software solutions
Merak Mail Server
WebSecureStores -- ASP.NET & DotNetNuke Hosting Solutions
FCKeditor Project
Salaro -- Skins and more
OnyakTech
 


DotNetNuke Forums
 
  Forum  DotNetNuke® Pro...  Forum Module [L...  [Forum_Thread_GetAll] Stored Procedure
Previous Previous
 
Next Next
New Post 6/30/2008 4:00 AM
Resolved
User is offline VarunC
20 posts
www.personal.com
10th Ranked


[Forum_Thread_GetAll] Stored Procedure 

Hi,

I was looking at the Forum Database structure and found this Stored Procedure.

This was very strnge to NOTE that there has been a condition check where you checked for Thread Existense based on :

FP.PostID = T.ThreadID

The above text was taken from the Dynamic SQL generated Inside this Stored Procedure: [Forum_Thread_GetAll]

Actual full content is this:

-- Create dynamic SQL to populate temporary table   
    SELECT  @sql = 'INSERT INTO #PageIndex (ThreadID)' + ' SELECT T.ThreadID' + ' FROM {databaseOwner}{objectQualifier}Forum_Threads T' + ' WHERE T.ThreadID IN' +
'   (SELECT TOP ' + CONVERT(VARCHAR, @PageSize) + ' T.ThreadID' + '     FROM {databaseOwner}{objectQualifier}Forum_Threads T' +
'     INNER JOIN {databaseOwner}{objectQualifier}Forum_Posts FP ON T.ThreadID = FP.ThreadID' + '     INNER JOIN {databaseOwner}{objectQualifier}Forum_Posts LP ON T.ThreadID = LP.ThreadID' +
'     INNER JOIN {databaseOwner}{objectQualifier}Forum_Forums F ON T.ForumID = F.ForumID' + '     INNER JOIN {databaseOwner}{objectQualifier}Forum_Groups FG ON F.GroupID = FG.GroupID' +
'     WHERE FG.ModuleID = ' + CONVERT(VARCHAR, @ModuleID) + '     AND (T.ForumID = ' + CONVERT(VARCHAR, @ForumID) + ' OR (' + CONVERT(VARCHAR, @ForumID) + ' = -1 AND F.PublicView = 1 AND T.IsPinned = 0))' +
'     AND LP.PostID = T.LastPostedPostID AND FP.PostID = T.ThreadID' +
'     AND (FP.IsApproved = 1)  AND (FP.IsLocked = 0) ' + @Filter + '     AND T.ThreadID NOT IN' +
'       (SELECT TOP ' + CONVERT(VARCHAR, @PageLowerBound) + ' T.ThreadID' +
'          FROM {databaseOwner}{objectQualifier}Forum_Threads T' +
'          INNER JOIN {databaseOwner}{objectQualifier}Forum_Posts FP ON T.ThreadID = FP.ThreadID' +
'          INNER JOIN {databaseOwner}{objectQualifier}Forum_Posts LP ON T.ThreadID = LP.ThreadID' +
'          INNER JOIN {databaseOwner}{objectQualifier}Forum_Forums F ON T.ForumID = F.ForumID' +
'          INNER JOIN {databaseOwner}{objectQualifier}Forum_Groups FG ON F.GroupID = FG.GroupID' +
'          WHERE FG.ModuleID = ' + CONVERT(VARCHAR, @ModuleID) +
'          AND (T.ForumID = ' + CONVERT(VARCHAR, @ForumID) + ' OR (' + CONVERT(VARCHAR, @ForumID) + ' = -1 AND F.PublicView = 1 AND T.IsPinned = 0))' +
'          AND LP.PostID = T.LastPostedPostID AND FP.PostID = T.ThreadID' +
'          AND (FP.IsApproved = 1)  AND (FP.IsLocked = 0) ' + @Filter +
'          ORDER BY T.IsPinned DESC, LP.CreatedDate DESC)' + ' ORDER BY T.IsPinned DESC, LP.CreatedDate DESC)'
    EXEC ( @sql )

Please guide me why this Check has been placed I'm really unable to understand that. Don't you think it should be this: FP.ThreadID = T.ThreadID

 

Thanks.

 
New Post 6/30/2008 12:11 PM
Accepted Answer 
User is offline VarunC
20 posts
www.personal.com
10th Ranked


Re: [Forum_Thread_GetAll] Stored Procedure 

ah .. I got it ... you are distinguishing First post as Thread as well as Post and thus PostID is Same as ThreadID. So that means, each Thread is a Post too. Sorry took me long to catch that :).

 
Previous Previous
 
Next Next
  Forum  DotNetNuke® Pro...  Forum Module [L...  [Forum_Thread_GetAll] Stored Procedure
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:

1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


Overlook Technology
Website Development, DotNetNuke Consulting, Module Development, Portal Management
OverlookTechnology.com
DeutschNetNuke = DotNetNuke in German
DeutschNetNuke provides all DotNetNuke related services in German (and English).
www.DeutschNetNuke.de
The Standard in Senior Housing Information
SNAPforSeniors provides consumers with free online resources to assist them with their search for senior housing
www.snapforseniors.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP