Added Grids and Images
This commit is contained in:
@@ -737,6 +737,57 @@ IF (@@Error = 0) PRINT 'Procedure Creation: addFormat Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: addFormat Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [addGrid] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[addGrid]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [addGrid];
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE [dbo].[addGrid]
|
||||
|
||||
(
|
||||
@ContentID int,
|
||||
@Data xml,
|
||||
@Config xml=null,
|
||||
@DTS datetime,
|
||||
@UserID nvarchar(100),
|
||||
@newLastChanged timestamp output
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN TRY -- Try Block
|
||||
BEGIN TRANSACTION
|
||||
INSERT INTO [Grids]
|
||||
(
|
||||
[ContentID],
|
||||
[Data],
|
||||
[Config],
|
||||
[DTS],
|
||||
[UserID]
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@ContentID,
|
||||
@Data,
|
||||
@Config,
|
||||
@DTS,
|
||||
@UserID
|
||||
)
|
||||
|
||||
SELECT @newLastChanged=[LastChanged]
|
||||
FROM [Grids] WHERE [ContentID]=@ContentID
|
||||
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
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: addGrid Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: addGrid Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [addGroup] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[addGroup]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [addGroup];
|
||||
@@ -789,6 +840,63 @@ IF (@@Error = 0) PRINT 'Procedure Creation: addGroup Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: addGroup Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [addImage] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[addImage]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [addImage];
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE [dbo].[addImage]
|
||||
|
||||
(
|
||||
@ContentID int,
|
||||
@ImageType int,
|
||||
@FileName nvarchar(255),
|
||||
@Data varbinary(MAX),
|
||||
@Config xml=null,
|
||||
@DTS datetime,
|
||||
@UserID nvarchar(100),
|
||||
@newLastChanged timestamp output
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN TRY -- Try Block
|
||||
BEGIN TRANSACTION
|
||||
INSERT INTO [Images]
|
||||
(
|
||||
[ContentID],
|
||||
[ImageType],
|
||||
[FileName],
|
||||
[Data],
|
||||
[Config],
|
||||
[DTS],
|
||||
[UserID]
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@ContentID,
|
||||
@ImageType,
|
||||
@FileName,
|
||||
@Data,
|
||||
@Config,
|
||||
@DTS,
|
||||
@UserID
|
||||
)
|
||||
|
||||
SELECT @newLastChanged=[LastChanged]
|
||||
FROM [Images] WHERE [ContentID]=@ContentID
|
||||
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
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: addImage Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: addImage Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [addItem] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[addItem]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [addItem];
|
||||
@@ -2144,6 +2252,10 @@ BEGIN TRY -- Try Block
|
||||
WHERE [ContentID]=@ContentID
|
||||
DELETE [Entries]
|
||||
WHERE [ContentID]=@ContentID
|
||||
DELETE [Grids]
|
||||
WHERE [ContentID]=@ContentID
|
||||
DELETE [Images]
|
||||
WHERE [ContentID]=@ContentID
|
||||
DELETE [Items]
|
||||
WHERE [ContentID]=@ContentID
|
||||
DELETE [Parts]
|
||||
@@ -2386,6 +2498,35 @@ IF (@@Error = 0) PRINT 'Procedure Creation: deleteFormat Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: deleteFormat Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [deleteGrid] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[deleteGrid]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [deleteGrid];
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE [dbo].[deleteGrid]
|
||||
|
||||
(
|
||||
@ContentID int
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN TRY -- Try Block
|
||||
BEGIN TRANSACTION
|
||||
DELETE [Grids]
|
||||
WHERE [ContentID] = @ContentID
|
||||
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
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: deleteGrid Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: deleteGrid Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [deleteGroup] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[deleteGroup]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [deleteGroup];
|
||||
@@ -2419,6 +2560,35 @@ IF (@@Error = 0) PRINT 'Procedure Creation: deleteGroup Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: deleteGroup Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [deleteImage] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[deleteImage]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [deleteImage];
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE [dbo].[deleteImage]
|
||||
|
||||
(
|
||||
@ContentID int
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN TRY -- Try Block
|
||||
BEGIN TRANSACTION
|
||||
DELETE [Images]
|
||||
WHERE [ContentID] = @ContentID
|
||||
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
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: deleteImage Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: deleteImage Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [deleteItem] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[deleteItem]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [deleteItem];
|
||||
@@ -3389,6 +3559,27 @@ IF (@@Error = 0) PRINT 'Procedure Creation: existsFormat Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: existsFormat Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [existsGrid] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[existsGrid]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [existsGrid];
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE [dbo].[existsGrid]
|
||||
|
||||
(
|
||||
@ContentID int
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
SELECT COUNT(*)
|
||||
FROM [Grids] WHERE [ContentID]=@ContentID
|
||||
RETURN
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: existsGrid Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: existsGrid Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [existsGroup] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[existsGroup]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [existsGroup];
|
||||
@@ -3410,6 +3601,27 @@ IF (@@Error = 0) PRINT 'Procedure Creation: existsGroup Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: existsGroup Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [existsImage] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[existsImage]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [existsImage];
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE [dbo].[existsImage]
|
||||
|
||||
(
|
||||
@ContentID int
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
SELECT COUNT(*)
|
||||
FROM [Images] WHERE [ContentID]=@ContentID
|
||||
RETURN
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: existsImage Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: existsImage Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [existsItem] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[existsItem]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [existsItem];
|
||||
@@ -4595,6 +4807,8 @@ AS
|
||||
[LastChanged],
|
||||
(SELECT COUNT(*) FROM [Details] WHERE [Details].[ContentID]=[Contents].[ContentID]) [DetailCount],
|
||||
(SELECT COUNT(*) FROM [Entries] WHERE [Entries].[ContentID]=[Contents].[ContentID]) [EntryCount],
|
||||
(SELECT COUNT(*) FROM [Grids] WHERE [Grids].[ContentID]=[Contents].[ContentID]) [GridCount],
|
||||
(SELECT COUNT(*) FROM [Images] WHERE [Images].[ContentID]=[Contents].[ContentID]) [ImageCount],
|
||||
(SELECT COUNT(*) FROM [Items] WHERE [Items].[ContentID]=[Contents].[ContentID]) [ItemCount],
|
||||
(SELECT COUNT(*) FROM [Parts] WHERE [Parts].[ContentID]=[Contents].[ContentID]) [PartCount],
|
||||
(SELECT COUNT(*) FROM [RoUsages] WHERE [RoUsages].[ContentID]=[Contents].[ContentID]) [RoUsageCount],
|
||||
@@ -4638,6 +4852,32 @@ AS
|
||||
[Entries].[ContentID]=@ContentID
|
||||
|
||||
|
||||
SELECT
|
||||
[Grids].[ContentID],
|
||||
[Grids].[Data],
|
||||
[Grids].[Config],
|
||||
[Grids].[DTS],
|
||||
[Grids].[UserID],
|
||||
[Grids].[LastChanged]
|
||||
FROM [Grids]
|
||||
WHERE
|
||||
[Grids].[ContentID]=@ContentID
|
||||
|
||||
|
||||
SELECT
|
||||
[Images].[ContentID],
|
||||
[Images].[ImageType],
|
||||
[Images].[FileName],
|
||||
[Images].[Data],
|
||||
[Images].[Config],
|
||||
[Images].[DTS],
|
||||
[Images].[UserID],
|
||||
[Images].[LastChanged]
|
||||
FROM [Images]
|
||||
WHERE
|
||||
[Images].[ContentID]=@ContentID
|
||||
|
||||
|
||||
SELECT
|
||||
[Items].[ItemID],
|
||||
[Items].[PreviousID],
|
||||
@@ -4754,6 +4994,8 @@ AS
|
||||
[LastChanged],
|
||||
(SELECT COUNT(*) FROM [Details] WHERE [Details].[ContentID]=[Contents].[ContentID]) [DetailCount],
|
||||
(SELECT COUNT(*) FROM [Entries] WHERE [Entries].[ContentID]=[Contents].[ContentID]) [EntryCount],
|
||||
(SELECT COUNT(*) FROM [Grids] WHERE [Grids].[ContentID]=[Contents].[ContentID]) [GridCount],
|
||||
(SELECT COUNT(*) FROM [Images] WHERE [Images].[ContentID]=[Contents].[ContentID]) [ImageCount],
|
||||
(SELECT COUNT(*) FROM [Items] WHERE [Items].[ContentID]=[Contents].[ContentID]) [ItemCount],
|
||||
(SELECT COUNT(*) FROM [Parts] WHERE [Parts].[ContentID]=[Contents].[ContentID]) [PartCount],
|
||||
(SELECT COUNT(*) FROM [RoUsages] WHERE [RoUsages].[ContentID]=[Contents].[ContentID]) [RoUsageCount],
|
||||
@@ -4792,6 +5034,8 @@ AS
|
||||
[Contents].[LastChanged],
|
||||
(SELECT COUNT(*) FROM [Details] WHERE [Details].[ContentID]=[Contents].[ContentID]) [DetailCount],
|
||||
(SELECT COUNT(*) FROM [Entries] WHERE [Entries].[ContentID]=[Contents].[ContentID]) [EntryCount],
|
||||
(SELECT COUNT(*) FROM [Grids] WHERE [Grids].[ContentID]=[Contents].[ContentID]) [GridCount],
|
||||
(SELECT COUNT(*) FROM [Images] WHERE [Images].[ContentID]=[Contents].[ContentID]) [ImageCount],
|
||||
(SELECT COUNT(*) FROM [Items] WHERE [Items].[ContentID]=[Contents].[ContentID]) [ItemCount],
|
||||
(SELECT COUNT(*) FROM [Parts] WHERE [Parts].[ContentID]=[Contents].[ContentID]) [PartCount],
|
||||
(SELECT COUNT(*) FROM [RoUsages] WHERE [RoUsages].[ContentID]=[Contents].[ContentID]) [RoUsageCount],
|
||||
@@ -5975,6 +6219,89 @@ IF (@@Error = 0) PRINT 'Procedure Creation: getFormats Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: getFormats Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [getGrid] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getGrid]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [getGrid];
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE [dbo].[getGrid]
|
||||
|
||||
(
|
||||
@ContentID int
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
SELECT
|
||||
[ContentID],
|
||||
[Data],
|
||||
[Config],
|
||||
[DTS],
|
||||
[UserID],
|
||||
[LastChanged]
|
||||
FROM [Grids]
|
||||
WHERE [ContentID]=@ContentID
|
||||
RETURN
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: getGrid Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: getGrid Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [getGrids] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getGrids]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [getGrids];
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE [dbo].[getGrids]
|
||||
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
SELECT
|
||||
[ContentID],
|
||||
[Data],
|
||||
[Config],
|
||||
[DTS],
|
||||
[UserID],
|
||||
[LastChanged]
|
||||
FROM [Grids]
|
||||
RETURN
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: getGrids Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: getGrids Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [getGridsByContentID] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getGridsByContentID]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [getGridsByContentID];
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE [dbo].[getGridsByContentID]
|
||||
|
||||
(
|
||||
@ContentID int
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
|
||||
SELECT
|
||||
[Grids].[ContentID],
|
||||
[Grids].[Data],
|
||||
[Grids].[Config],
|
||||
[Grids].[DTS],
|
||||
[Grids].[UserID],
|
||||
[Grids].[LastChanged]
|
||||
FROM [Grids]
|
||||
WHERE
|
||||
[Grids].[ContentID]=@ContentID
|
||||
|
||||
RETURN
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: getGridsByContentID Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: getGridsByContentID Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [getGroup] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getGroup]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [getGroup];
|
||||
@@ -6126,6 +6453,95 @@ IF (@@Error = 0) PRINT 'Procedure Creation: getGroups Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: getGroups Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [getImage] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getImage]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [getImage];
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE [dbo].[getImage]
|
||||
|
||||
(
|
||||
@ContentID int
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
SELECT
|
||||
[ContentID],
|
||||
[ImageType],
|
||||
[FileName],
|
||||
[Data],
|
||||
[Config],
|
||||
[DTS],
|
||||
[UserID],
|
||||
[LastChanged]
|
||||
FROM [Images]
|
||||
WHERE [ContentID]=@ContentID
|
||||
RETURN
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: getImage Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: getImage Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [getImages] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getImages]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [getImages];
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE [dbo].[getImages]
|
||||
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
SELECT
|
||||
[ContentID],
|
||||
[ImageType],
|
||||
[FileName],
|
||||
[Data],
|
||||
[Config],
|
||||
[DTS],
|
||||
[UserID],
|
||||
[LastChanged]
|
||||
FROM [Images]
|
||||
RETURN
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: getImages Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: getImages Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [getImagesByContentID] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getImagesByContentID]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [getImagesByContentID];
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE [dbo].[getImagesByContentID]
|
||||
|
||||
(
|
||||
@ContentID int
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
|
||||
SELECT
|
||||
[Images].[ContentID],
|
||||
[Images].[ImageType],
|
||||
[Images].[FileName],
|
||||
[Images].[Data],
|
||||
[Images].[Config],
|
||||
[Images].[DTS],
|
||||
[Images].[UserID],
|
||||
[Images].[LastChanged]
|
||||
FROM [Images]
|
||||
WHERE
|
||||
[Images].[ContentID]=@ContentID
|
||||
|
||||
RETURN
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: getImagesByContentID Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: getImagesByContentID Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [getItem] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getItem]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [getItem];
|
||||
@@ -8812,6 +9228,8 @@ BEGIN TRY -- Try Block
|
||||
dbcc checkident([Figures],reseed,0)
|
||||
delete from [Folders]
|
||||
dbcc checkident([Folders],reseed,0)
|
||||
delete from [Grids]
|
||||
delete from [Images]
|
||||
delete from [Memberships]
|
||||
dbcc checkident([Memberships],reseed,0)
|
||||
delete from [Parts]
|
||||
@@ -9587,6 +10005,57 @@ IF (@@Error = 0) PRINT 'Procedure Creation: updateFormat Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: updateFormat Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [updateGrid] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[updateGrid]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [updateGrid];
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE [dbo].[updateGrid]
|
||||
|
||||
(
|
||||
@ContentID int,
|
||||
@Data xml,
|
||||
@Config xml=null,
|
||||
@DTS datetime,
|
||||
@UserID nvarchar(100),
|
||||
@LastChanged timestamp,
|
||||
@newLastChanged timestamp output
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN TRY -- Try Block
|
||||
BEGIN TRANSACTION
|
||||
UPDATE [Grids]
|
||||
SET
|
||||
[Data]=@Data,
|
||||
[Config]=@Config,
|
||||
[DTS]=@DTS,
|
||||
[UserID]=@UserID
|
||||
WHERE [ContentID]=@ContentID AND [LastChanged]=@LastChanged
|
||||
IF @@ROWCOUNT = 0
|
||||
BEGIN
|
||||
IF NOT exists(select * from [Grids] WHERE [ContentID]=@ContentID)
|
||||
RAISERROR('Grid record has been deleted by another user', 16, 1)
|
||||
ELSE
|
||||
RAISERROR('Grid has been edited by another user', 16, 1)
|
||||
END
|
||||
|
||||
SELECT @newLastChanged=[LastChanged]
|
||||
FROM [Grids] WHERE [ContentID]=@ContentID
|
||||
|
||||
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
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: updateGrid Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: updateGrid Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [updateGroup] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[updateGroup]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [updateGroup];
|
||||
@@ -9640,6 +10109,61 @@ IF (@@Error = 0) PRINT 'Procedure Creation: updateGroup Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: updateGroup Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [updateImage] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[updateImage]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [updateImage];
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE [dbo].[updateImage]
|
||||
|
||||
(
|
||||
@ContentID int,
|
||||
@ImageType int,
|
||||
@FileName nvarchar(255),
|
||||
@Data varbinary(MAX),
|
||||
@Config xml=null,
|
||||
@DTS datetime,
|
||||
@UserID nvarchar(100),
|
||||
@LastChanged timestamp,
|
||||
@newLastChanged timestamp output
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN TRY -- Try Block
|
||||
BEGIN TRANSACTION
|
||||
UPDATE [Images]
|
||||
SET
|
||||
[ImageType]=@ImageType,
|
||||
[FileName]=@FileName,
|
||||
[Data]=@Data,
|
||||
[Config]=@Config,
|
||||
[DTS]=@DTS,
|
||||
[UserID]=@UserID
|
||||
WHERE [ContentID]=@ContentID AND [LastChanged]=@LastChanged
|
||||
IF @@ROWCOUNT = 0
|
||||
BEGIN
|
||||
IF NOT exists(select * from [Images] WHERE [ContentID]=@ContentID)
|
||||
RAISERROR('Image record has been deleted by another user', 16, 1)
|
||||
ELSE
|
||||
RAISERROR('Image has been edited by another user', 16, 1)
|
||||
END
|
||||
|
||||
SELECT @newLastChanged=[LastChanged]
|
||||
FROM [Images] WHERE [ContentID]=@ContentID
|
||||
|
||||
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
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: updateImage Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: updateImage Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [updateItem] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[updateItem]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [updateItem];
|
||||
|
Reference in New Issue
Block a user