vesp_GetDisconnectedItemsCount - Fixed to account for Deleted Items
vesp_PurgeDisconnectedData- Stored procedure to remove disconnected data Fixed the window header to show the SQl Server name and the Database name
This commit is contained in:
parent
497b614111
commit
15d8380fe6
@ -10292,10 +10292,10 @@ BEGIN
|
|||||||
declare @UsedItems Table
|
declare @UsedItems Table
|
||||||
( itemid int primary key, contentid int)
|
( itemid int primary key, contentid int)
|
||||||
insert into @UsedItems
|
insert into @UsedItems
|
||||||
Select ItemID, ContentID from vefn_GetVersionItems('')
|
Select ItemID, ContentID from vefn_GetVersiontblItems('')
|
||||||
insert into @DiscItems
|
insert into @DiscItems
|
||||||
select itemid,ii.contentid from (
|
select itemid,ii.contentid from (
|
||||||
Select ItemID,ii.ContentID from Items II
|
Select ItemID,ii.ContentID from tblItems II
|
||||||
where ItemID not in(select ItemID from @UsedItems)) ii
|
where ItemID not in(select ItemID from @UsedItems)) ii
|
||||||
Join Contents CC ON CC.ContentID = II.ContentID
|
Join Contents CC ON CC.ContentID = II.ContentID
|
||||||
And CC.Type is not null
|
And CC.Type is not null
|
||||||
@ -11242,4 +11242,138 @@ IF (@@Error = 0) PRINT 'TableFunction Creation: vefn_GetEnhancedProcedures Succe
|
|||||||
ELSE PRINT 'TableFunction Creation: vefn_GetEnhancedProcedures Error on Creation'
|
ELSE PRINT 'TableFunction Creation: vefn_GetEnhancedProcedures Error on Creation'
|
||||||
GO
|
GO
|
||||||
|
|
||||||
PRINT '20160106 Enhanced Documents'
|
PRINT '20160106 Enhanced Documents'
|
||||||
|
|
||||||
|
GO
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_GetVersionTblItems]') AND OBJECTPROPERTY(id,N'IsTableFunction') = 1)
|
||||||
|
DROP FUNCTION [vefn_GetVersionTblItems];
|
||||||
|
GO
|
||||||
|
/****** Object: UserDefinedFunction [dbo].[vefn_GetVersionTblItems] ******/
|
||||||
|
SET ANSI_NULLS ON
|
||||||
|
GO
|
||||||
|
SET QUOTED_IDENTIFIER ON
|
||||||
|
GO
|
||||||
|
/*
|
||||||
|
Select * from vefn_GetVersionTblItems('')
|
||||||
|
*/
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2013 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE FUNCTION [dbo].[vefn_GetVersionTblItems](@DocVersionList varchar(MAX))
|
||||||
|
RETURNS @VersionItems TABLE
|
||||||
|
(
|
||||||
|
VersionID int,
|
||||||
|
ItemID int,
|
||||||
|
ContentID int primary key
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
BEGIN
|
||||||
|
BEGIN
|
||||||
|
with Itemz([VersionID], [ItemID], [ContentID]) as
|
||||||
|
(Select DV.VersionID, [I].[ItemID], [I].[ContentID]
|
||||||
|
FROM [tblItems] I
|
||||||
|
JOIN vefn_DocVersionSplit(@DocVersionList) DV
|
||||||
|
ON I.[ItemID] = DV.[ItemID]
|
||||||
|
Union All
|
||||||
|
-- Children
|
||||||
|
select Z.VersionID, I.[ItemID], I.[ContentID]
|
||||||
|
from Itemz Z
|
||||||
|
join tblParts P on P.ContentID = Z.ContentID
|
||||||
|
join tblItems I on I.ItemID = P.ItemID
|
||||||
|
Union All
|
||||||
|
-- Siblings
|
||||||
|
select Z.VersionID, I.[ItemID], I.[ContentID]
|
||||||
|
from Itemz Z
|
||||||
|
join tblItems I on I.PreviousID = Z.ItemID
|
||||||
|
)
|
||||||
|
insert into @VersionItems
|
||||||
|
select VersionID, [ItemID], [ContentID]
|
||||||
|
from ItemZ I
|
||||||
|
--Select * From rousages RU Where RU.ContentID in (Select ContentID from ItemZ)
|
||||||
|
OPTION (MAXRECURSION 10000)
|
||||||
|
END
|
||||||
|
RETURN
|
||||||
|
END
|
||||||
|
|
||||||
|
go
|
||||||
|
IF (@@Error = 0) PRINT 'TableFunction [vefn_GetVersionTblItems] Succeeded'
|
||||||
|
ELSE PRINT 'TableFunction [vefn_GetVersionTblItems] Error on Creation'
|
||||||
|
|
||||||
|
GO
|
||||||
|
/****** Object: StoredProcedure [addROImage] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_PurgeDisconnectedData]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE vesp_PurgeDisconnectedData;
|
||||||
|
GO
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2012 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE PROCEDURE [dbo].[vesp_PurgeDisconnectedData]
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
BEGIN TRY -- Try Block
|
||||||
|
BEGIN TRANSACTION
|
||||||
|
declare @UsedItems Table
|
||||||
|
( itemid int primary key, contentID int )
|
||||||
|
insert into @UsedItems
|
||||||
|
Select ItemID, ContentID from vefn_GetVersiontblItems('')
|
||||||
|
|
||||||
|
select 'Working Drafts' Query, FolderName,Dv.* from DocVersions DV
|
||||||
|
JOIN VEFN_GetVersionNames() VN ON DV.VersionID = VN.VersionID
|
||||||
|
|
||||||
|
declare @DiscItems Table
|
||||||
|
( itemid int primary key, ContentID int)
|
||||||
|
insert into @DiscItems
|
||||||
|
Select ItemID, II.ContentID from tblItems II
|
||||||
|
Join tblContents CC ON CC.ContentID = II.ContentID
|
||||||
|
where ItemID not in(select ItemID from @UsedItems)
|
||||||
|
And CC.Type is not null
|
||||||
|
|
||||||
|
delete from [Checks] where RevisionID in (select RevisionID from Revisions where ItemID in (select itemid from @DiscItems))
|
||||||
|
delete from [Versions] where RevisionID in (select RevisionID from Revisions where ItemID in (select itemid from @DiscItems))
|
||||||
|
delete from [Revisions] where ItemID in (select itemid from @DiscItems)
|
||||||
|
delete from [AnnotationAudits] where ItemID in (select itemid from @DiscItems)
|
||||||
|
delete from [ItemAudits] where ItemID in (select itemid from @DiscItems)
|
||||||
|
delete from [tblParts] where ItemID in (select itemid from @DiscItems)
|
||||||
|
delete from [DocVersions] where ItemID in (select itemid from @DiscItems)
|
||||||
|
delete from [PartAudits] where ItemID in (select itemid from @DiscItems)
|
||||||
|
delete from [tblAnnotations] where ItemID in (select itemid from @DiscItems)
|
||||||
|
|
||||||
|
delete from [Details] where contentID in (select contentid from @DiscItems)
|
||||||
|
delete from [ZContents] where contentID in (select contentid from @DiscItems)
|
||||||
|
delete from [tblGrids] where contentID in (select contentid from @DiscItems)
|
||||||
|
delete from [tblImages] where contentID in (select contentid from @DiscItems)
|
||||||
|
delete from [ContentAudits] where contentID in (select contentid from @DiscItems)
|
||||||
|
delete from [tblROUsages] where contentID in (select contentid from @DiscItems)
|
||||||
|
delete from [EntryAudits] where contentID in (select contentid from @DiscItems)
|
||||||
|
delete from [tblEntries] where contentID in (select contentid from @DiscItems)
|
||||||
|
delete from [GridAudits] where contentID in (select contentid from @DiscItems)
|
||||||
|
delete from [ImageAudits] where contentID in (select contentid from @DiscItems)
|
||||||
|
delete from [ItemAudits] where contentID in (select contentid from @DiscItems)
|
||||||
|
delete from [tblParts] where contentID in (select contentid from @DiscItems)
|
||||||
|
delete from [PartAudits] where contentID in (select contentid from @DiscItems)
|
||||||
|
delete from [ROUsageAudits] where contentID in (select contentid from @DiscItems)
|
||||||
|
delete from [ztransitions] where transitionid in(select transitionid from [tblTransitions] where fromid in (select contentid from @DiscItems))
|
||||||
|
delete from [ztransitions] where transitionid in(select transitionid from [tblTransitions] where toid in (select itemid from @DiscItems))
|
||||||
|
delete from [ztransitions] where transitionid in(select transitionid from [tblTransitions] where rangeid in (select itemid from @DiscItems))
|
||||||
|
delete from [tblTransitions] where fromid in (select contentid from @DiscItems)
|
||||||
|
delete from [tblTransitions] where toid in (select itemid from @DiscItems)
|
||||||
|
delete from [tblTransitions] where rangeid in (select itemid from @DiscItems)
|
||||||
|
delete from [tblItems] where PreviousID in (select itemid from @DiscItems)
|
||||||
|
delete from [tblItems] where ItemID in (select itemid from @DiscItems)
|
||||||
|
delete from [tblItems] where contentID in (select contentid from @DiscItems)
|
||||||
|
delete from [tblContents] where contentID in (select contentid from @DiscItems)
|
||||||
|
IF( @@TRANCOUNT > 0 ) COMMIT
|
||||||
|
END TRY
|
||||||
|
BEGIN CATCH -- Catch Block
|
||||||
|
IF( @@TRANCOUNT = 1 ) ROLLBACK -- Only rollback if top level
|
||||||
|
ELSE IF( @@TRANCOUNT > 1 ) COMMIT -- Otherwise commit. Top level will rollback
|
||||||
|
EXEC vlnErrorHandler
|
||||||
|
END CATCH
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: vesp_PurgeDisconnectedData Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: vesp_PurgeDisconnectedData Error on Creation'
|
||||||
|
GO
|
||||||
|
PRINT '20150808 Improved performance for delete procedure'
|
||||||
|
@ -1274,6 +1274,8 @@ namespace VEPROMS
|
|||||||
tc.MySessionInfo = MySessionInfo;
|
tc.MySessionInfo = MySessionInfo;
|
||||||
tv.MySessionInfo = MySessionInfo;
|
tv.MySessionInfo = MySessionInfo;
|
||||||
tv.MyUserInfo = MyUserInfo;
|
tv.MyUserInfo = MyUserInfo;
|
||||||
|
// Initialize Caption with Server name and Database name.
|
||||||
|
SetCaption(tv.TopNode as VETreeNode);
|
||||||
System.Threading.AutoResetEvent autoEvent = new System.Threading.AutoResetEvent(false);
|
System.Threading.AutoResetEvent autoEvent = new System.Threading.AutoResetEvent(false);
|
||||||
//System.Threading.TimerCallback timerDelegate = new System.Threading.TimerCallback(MySessionInfo.PingSession);
|
//System.Threading.TimerCallback timerDelegate = new System.Threading.TimerCallback(MySessionInfo.PingSession);
|
||||||
//System.Diagnostics.Process xyzzy = System.Diagnostics.Process.GetCurrentProcess();
|
//System.Diagnostics.Process xyzzy = System.Diagnostics.Process.GetCurrentProcess();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user