GUACAMOLE-363: Do not take behind-the-scenes trigger operations into account when calculating the row counts for a query.

This commit is contained in:
Michael Jumper
2017-11-25 21:54:41 -08:00
parent 56da0b0c75
commit 23084625ab

View File

@@ -559,6 +559,9 @@ CREATE TRIGGER [guacamole_delete_user]
INSTEAD OF DELETE INSTEAD OF DELETE
AS BEGIN AS BEGIN
-- Do not take trigger into account when producing row counts for the DELETE
SET NOCOUNT ON;
-- Delete all associated permissions not covered by ON DELETE CASCADE -- Delete all associated permissions not covered by ON DELETE CASCADE
DELETE FROM [guacamole_user_permission] DELETE FROM [guacamole_user_permission]
WHERE WHERE
@@ -583,6 +586,9 @@ CREATE TRIGGER [guacamole_delete_connection]
INSTEAD OF DELETE INSTEAD OF DELETE
AS BEGIN AS BEGIN
-- Do not take trigger into account when producing row counts for the DELETE
SET NOCOUNT ON;
-- Delete associated sharing profiles -- Delete associated sharing profiles
DELETE FROM [guacamole_sharing_profile] DELETE FROM [guacamole_sharing_profile]
WHERE [primary_connection_id] IN (SELECT [connection_id] FROM DELETED); WHERE [primary_connection_id] IN (SELECT [connection_id] FROM DELETED);
@@ -605,6 +611,9 @@ CREATE TRIGGER [guacamole_delete_connection_group]
INSTEAD OF DELETE INSTEAD OF DELETE
AS BEGIN AS BEGIN
-- Do not take trigger into account when producing row counts for the DELETE
SET NOCOUNT ON;
-- Delete all requested connection groups, including descendants -- Delete all requested connection groups, including descendants
WITH [connection_groups] ([connection_group_id]) AS ( WITH [connection_groups] ([connection_group_id]) AS (
SELECT [connection_group_id] FROM DELETED SELECT [connection_group_id] FROM DELETED
@@ -637,6 +646,9 @@ CREATE TRIGGER [guacamole_delete_sharing_profile]
INSTEAD OF DELETE INSTEAD OF DELETE
AS BEGIN AS BEGIN
-- Do not take trigger into account when producing row counts for the DELETE
SET NOCOUNT ON;
-- Delete all associated permissions not covered by ON DELETE CASCADE -- Delete all associated permissions not covered by ON DELETE CASCADE
UPDATE [guacamole_connection_history] UPDATE [guacamole_connection_history]
SET [sharing_profile_id] = NULL SET [sharing_profile_id] = NULL