From f66cb15dd39e0505804cc01c2e2c5c9e41a6844b Mon Sep 17 00:00:00 2001 From: Jim Date: Sat, 16 May 2015 16:59:36 +0000 Subject: [PATCH] Added stored procedures to support determining when treeview needs to be refreshed based on other user activities --- PROMS/DataLoader/PROMSFixes.Sql | 69 ++++++++++++++++++++++++++------- 1 file changed, 54 insertions(+), 15 deletions(-) diff --git a/PROMS/DataLoader/PROMSFixes.Sql b/PROMS/DataLoader/PROMSFixes.Sql index aeb327bb..93f453a8 100644 --- a/PROMS/DataLoader/PROMSFixes.Sql +++ b/PROMS/DataLoader/PROMSFixes.Sql @@ -3382,8 +3382,9 @@ where FoundEnd = 0 ) insert into @Children select ItemID, ContentID, FormatID from Itemz OPTION (MAXRECURSION 10000) -RETURN + END +RETURN END GO -- Display the status of Proc creation @@ -3518,8 +3519,8 @@ UNION select TransitionID from Transitions TT JOIN Itemz2 on ToID=ItemID and RangeID=ItemID and IsRange = 2 OPTION (MAXRECURSION 10000) -RETURN END +RETURN END GO @@ -3828,8 +3829,8 @@ BEGIN ) Select @FormatID = FormatID from Itemz ZZ Where FormatID is not null OPTION (MAXRECURSION 10000) - RETURN @FormatID END + RETURN @FormatID END GO -- Display the status of Proc creation @@ -7186,7 +7187,8 @@ AS [DTSActivity], [LastChanged], [MachineName], - [ProcessID] + [ProcessID], + (select convert(bigint,max(lastchanged)) from contents) LastContentChange FROM [Sessions] RETURN GO @@ -7370,7 +7372,8 @@ AS [DTSActivity], [LastChanged], [MachineName], - [ProcessID] + [ProcessID], + (select convert(bigint,max(lastchanged)) from contents) LastContentChange FROM [Sessions] WHERE [SessionID]=@SessionID RETURN @@ -7435,7 +7438,8 @@ BEGIN TRY -- Try Block [DTSActivity], [LastChanged], [MachineName], - [ProcessID] + [ProcessID], + (select convert(bigint,max(lastchanged)) from contents) LastContentChange FROM [Sessions] WHERE [SessionID]=0 END @@ -7460,7 +7464,8 @@ BEGIN TRY -- Try Block [DTSActivity], [LastChanged], [MachineName], - [ProcessID] + [ProcessID], + (select convert(bigint,max(lastchanged)) from contents) LastContentChange FROM [Sessions] WHERE [SessionID]=SCOPE_IDENTITY() IF( @@TRANCOUNT > 0 ) COMMIT @@ -7825,7 +7830,8 @@ BEGIN [DTSActivity], [LastChanged], [MachineName], - [ProcessID] + [ProcessID], + (select convert(bigint,max(lastchanged)) from contents) LastContentChange FROM [Sessions] WHERE DTSEnd IS NULL END ELSE BEGIN @@ -7899,7 +7905,8 @@ BEGIN [DTSActivity], [LastChanged], [MachineName], - [ProcessID] + [ProcessID], + (select convert(bigint,max(lastchanged)) from contents) LastContentChange FROM [Sessions] WHERE [SessionID] IN (SELECT SessionID FROM @CheckOuts) END @@ -9823,8 +9830,8 @@ DECLARE @FormatID as int ) Select @FormatID = FormatID from Itemz ZZ Where FormatID is not null OPTION (MAXRECURSION 10000) - RETURN @FormatID END + RETURN @FormatID END GO -- Display the status of Proc creation @@ -10739,7 +10746,7 @@ GO *****************************************************************************/ CREATE PROCEDURE vesp_ListContentsAfterLastChanged2 ( - @LastChanged timestamp, + @LastChanged bigint, @UserID nvarchar(100) ) WITH EXECUTE AS OWNER @@ -10747,10 +10754,10 @@ AS BEGIN SELECT cc.[ContentID], - cc.[LastChanged] + CONVERT(bigint,cc.[LastChanged]) LastContentChange FROM [Contents] cc - WHERE cc.LastChanged > @LastChanged - AND cc.UserID != @UserID + WHERE CONVERT(bigint,cc.LastChanged) > @LastChanged +-- AND cc.UserID != @UserID ORDER BY LastChanged RETURN END @@ -10810,4 +10817,36 @@ GO -- Display the status of Proc creation IF (@@Error = 0) PRINT 'Procedure Creation: getOwnerBySessionIDandFolderID Succeeded' ELSE PRINT 'Procedure Creation: getOwnerBySessionIDandFolderID Error on Creation' -GO \ No newline at end of file +GO + +/****** Object: StoredProcedure [vesp_ListItemsAfterLastChanged] ******/ +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_ListItemsAfterLastChanged]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) + DROP PROCEDURE vesp_ListItemsAfterLastChanged; +GO + +/***************************************************************************** + Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE + Copyright 2012 - Volian Enterprises, Inc. All rights reserved. +*****************************************************************************/ +CREATE PROCEDURE vesp_ListItemsAfterLastChanged +( + @LastChanged bigint, + @UserID nvarchar(100) +) +WITH EXECUTE AS OWNER +AS +BEGIN + SELECT + dbo.ve_GetParentItem(ii.[ItemID]) ParentID,MAX(CONVERT(bigint,ii.[LastChanged])) LastItemChange + FROM [Items] ii + WHERE CONVERT(bigint,ii.LastChanged) > @LastChanged +-- AND cc.UserID != @UserID + GROUP BY dbo.ve_GetParentItem(ii.[ItemID]) + ORDER BY MAX(CONVERT(bigint,ii.[LastChanged])) + RETURN +END +GO +-- Display the status of Proc creation +IF (@@Error = 0) PRINT 'Procedure Creation: vesp_ListItemsAfterLastChanged Succeeded' +ELSE PRINT 'Procedure Creation: vesp_ListItemsAfterLastChanged Error on Creation' +GO