Skip to content

Commit

Permalink
Use SQL system catalog views to check for the presence of a Recoverab…
Browse files Browse the repository at this point in the history
…le column. This removes the need for SELECT permissions to send a message to a queue table.

Co-authored-by: Marc Wils <marc@marcwils.be.eu.org>
  • Loading branch information
tmasternak and MarcWils committed Oct 17, 2024
1 parent c6b5359 commit 8a73690
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace NServiceBus.Transport.SqlServer.AcceptanceTests.NativeTimeouts
namespace NServiceBus.Transport.SqlServer.AcceptanceTests.NativeTimeouts
{
using System;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace NServiceBus.Transport.SqlServer.IntegrationTests
namespace NServiceBus.Transport.SqlServer.IntegrationTests
{
using System;
using System.Threading;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace NServiceBus.Transport.SqlServer.IntegrationTests
namespace NServiceBus.Transport.SqlServer.IntegrationTests
{
using System;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace NServiceBus.Transport.SqlServer.IntegrationTests
namespace NServiceBus.Transport.SqlServer.IntegrationTests
{
using System;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace NServiceBus.Transport.SqlServer.IntegrationTests
namespace NServiceBus.Transport.SqlServer.IntegrationTests
{
using System;
using System.Linq;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace NServiceBus.Transport.SqlServer.IntegrationTests
namespace NServiceBus.Transport.SqlServer.IntegrationTests
{
using System;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace NServiceBus.Transport.SqlServer.IntegrationTests
namespace NServiceBus.Transport.SqlServer.IntegrationTests
{
using System;
using System.Collections.Generic;
Expand Down
6 changes: 5 additions & 1 deletion src/NServiceBus.Transport.SqlServer/Queuing/SqlConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ THEN DATEADD(ms, @TimeToBeReceivedMs, GETUTCDATE()) END,
IF (@NOCOUNT = 'ON') SET NOCOUNT ON;
IF (@NOCOUNT = 'OFF') SET NOCOUNT OFF;";

public static readonly string CheckIfTableHasRecoverableText = "SELECT TOP (0) * FROM {0} WITH (NOLOCK);";
public static string CheckIfTableHasRecoverableText { get; set; } = @"
SELECT COUNT(*)
FROM {0}.sys.columns c
WHERE c.object_id = OBJECT_ID(N'{1}')
AND c.name = 'Recoverable'";

public static readonly string StoreDelayedMessageText =
@"
Expand Down

0 comments on commit 8a73690

Please sign in to comment.