Added code to implement administrative tools functions inside database
This commit is contained in:
parent
f30f058fac
commit
ac85235031
@ -10604,3 +10604,136 @@ IF (@@Error = 0) PRINT 'Procedure Creation: vesp_GetNonEditableItems Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: vesp_GetNonEditableItems Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vesp_GetDatabaseSessions] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_GetDatabaseSessions]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE vesp_GetDatabaseSessions;
|
||||
GO
|
||||
|
||||
/*****************************************************************************
|
||||
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||
Copyright 2012 - Volian Enterprises, Inc. All rights reserved.
|
||||
*****************************************************************************/
|
||||
CREATE PROCEDURE vesp_GetDatabaseSessions
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
select t1.SessionID,t1.UserID,t1.MachineName,t1.OwnerTypeName,t1.HowMany,t1.Status,
|
||||
t2.FolderName,t2.GrandParentName,t2.ParentName,t2.ItemPath,t2.DTSStart from
|
||||
(
|
||||
select ss.SessionID,UserID,MachineName,ISNULL(OwnerType,0) OwnerType,ISNULL(OwnerTypeName,'Nothing') OwnerTypeName,ISNULL(HowMany,0) HowMany,
|
||||
case when DATEDIFF(SECOND,DTSActivity,GETDATE()) > 60 then 'IN-ACTIVE (' + CAST(DATEDIFF(SECOND,DTSActivity,GETDATE()) as varchar(10)) + ' Seconds)' else 'Active' end Status
|
||||
from Sessions ss
|
||||
left join
|
||||
(select SessionID,OwnerType,case OwnerType when 0 then 'Procedure' when 1 then 'Document' when 2 then 'Working Draft' else 'Database' end OwnerTypeName,count(*) HowMany from Owners group by SessionID,OwnerType) oo on ss.SessionID = oo.SessionID
|
||||
where ss.DTSEnd is null
|
||||
) t1
|
||||
left join
|
||||
(
|
||||
select oo.SessionID,oo.OwnerID,oo.DTSStart,oo.OwnerType,
|
||||
dbo.ve_GetShortPath(oo.OwnerItemID) ItemPath,
|
||||
vn.FolderName,vn.GrandParentName,vn.ParentName
|
||||
from Owners oo
|
||||
join vefn_GetVersionItems('') vi on oo.OwnerItemID = vi.ItemID
|
||||
join vefn_GetVersionNames() vn on vi.VersionID = vn.VersionID
|
||||
where oo.OwnerType = 0
|
||||
union
|
||||
select distinct oo.SessionID,oo.OwnerID,oo.DTSStart,oo.OwnerType,
|
||||
case when isnull(LibTitle,'') = '' then dbo.ve_getshortpathfromcontentid(ee.contentid) else 'Library Document: ' + LibTitle end ItemPath,
|
||||
vn.FolderName,vn.GrandParentName,vn.ParentName
|
||||
from Owners oo
|
||||
join Documents dd on oo.OwnerItemID = dd.DocID
|
||||
join Entries ee on oo.OwnerItemID = ee.DocID
|
||||
join vefn_GetVersionItems('') vi on ee.ContentID = vi.ContentID
|
||||
join vefn_GetVersionNames() vn on vi.VersionID = vn.VersionID
|
||||
where oo.OwnerType = 1
|
||||
union
|
||||
select oo.SessionID,oo.OwnerID,oo.DTSStart,oo.OwnerType,
|
||||
dv.Name ItemPath,vn.FolderName,vn.GrandParentName,vn.ParentName
|
||||
from Owners oo
|
||||
join DocVersions dv on oo.OwnerItemID = dv.VersionID
|
||||
join vefn_GetVersionNames() vn on dv.VersionID = vn.VersionID
|
||||
where oo.OwnerType = 2
|
||||
) t2 on t1.SessionID = t2.SessionID and t1.OwnerType = t2.OwnerType
|
||||
order by t1.SessionID,t1.OwnerType
|
||||
RETURN
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: vesp_GetDatabaseSessions Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: vesp_GetDatabaseSessions Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vesp_ListContentsAfterLastChanged] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_ListContentsAfterLastChanged]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE vesp_ListContentsAfterLastChanged;
|
||||
GO
|
||||
|
||||
/*****************************************************************************
|
||||
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||
Copyright 2012 - Volian Enterprises, Inc. All rights reserved.
|
||||
*****************************************************************************/
|
||||
CREATE PROCEDURE vesp_ListContentsAfterLastChanged
|
||||
(
|
||||
@LastChanged timestamp
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
SELECT
|
||||
cc.[ContentID],
|
||||
cc.[Number],
|
||||
cc.[Text],
|
||||
cc.[Type],
|
||||
cc.[FormatID],
|
||||
cc.[Config],
|
||||
cc.[DTS],
|
||||
cc.[UserID],
|
||||
cc.[LastChanged],
|
||||
(SELECT COUNT(*) FROM [Details] WHERE [Details].[ContentID]=cc.[ContentID]) [DetailCount],
|
||||
(SELECT COUNT(*) FROM [Entries] WHERE [Entries].[ContentID]=cc.[ContentID]) [EntryCount],
|
||||
(SELECT COUNT(*) FROM [Grids] WHERE [Grids].[ContentID]=cc.[ContentID]) [GridCount],
|
||||
(SELECT COUNT(*) FROM [Images] WHERE [Images].[ContentID]=cc.[ContentID]) [ImageCount],
|
||||
(SELECT COUNT(*) FROM [Items] WHERE [Items].[ContentID]=cc.[ContentID]) [ItemCount],
|
||||
(SELECT COUNT(*) FROM [Parts] WHERE [Parts].[ContentID]=cc.[ContentID]) [PartCount],
|
||||
(SELECT COUNT(*) FROM [RoUsages] WHERE [RoUsages].[ContentID]=cc.[ContentID]) [RoUsageCount],
|
||||
(SELECT COUNT(*) FROM [Transitions] WHERE [Transitions].[FromID]=cc.[ContentID]) [TransitionCount],
|
||||
(SELECT COUNT(*) FROM [ZContents] WHERE [ZContents].[ContentID]=cc.[ContentID]) [ZContentCount]
|
||||
FROM [Contents] cc
|
||||
WHERE cc.LastChanged > @LastChanged
|
||||
RETURN
|
||||
END
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: vesp_ListContentsAfterLastChanged Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: vesp_ListContentsAfterLastChanged Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vesp_ListContentsAfterLastChanged2] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_ListContentsAfterLastChanged2]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE vesp_ListContentsAfterLastChanged2;
|
||||
GO
|
||||
|
||||
/*****************************************************************************
|
||||
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||
Copyright 2012 - Volian Enterprises, Inc. All rights reserved.
|
||||
*****************************************************************************/
|
||||
CREATE PROCEDURE vesp_ListContentsAfterLastChanged2
|
||||
(
|
||||
@LastChanged timestamp,
|
||||
@UserID nvarchar(100)
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
SELECT
|
||||
cc.[ContentID],
|
||||
cc.[LastChanged]
|
||||
FROM [Contents] cc
|
||||
WHERE cc.LastChanged > @LastChanged
|
||||
AND cc.UserID != @UserID
|
||||
ORDER BY LastChanged
|
||||
RETURN
|
||||
END
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: vesp_ListContentsAfterLastChanged2 Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: vesp_ListContentsAfterLastChanged2 Error on Creation'
|
||||
GO
|
||||
|
Loading…
x
Reference in New Issue
Block a user