-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,40 +2,54 @@ namespace NServiceBus.Transport.SQLServer | |
{ | ||
class LegacySql | ||
{ | ||
internal const string CreateQueueText = @"IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'{0}') AND type in (N'U')) | ||
BEGIN | ||
EXEC sp_getapplock @Resource = '{0}_lock', @LockMode = 'Exclusive' | ||
public static readonly string CreateQueueText = @" | ||
IF EXISTS ( | ||
SELECT * | ||
FROM sys.objects | ||
WHERE object_id = OBJECT_ID(N'{0}') | ||
AND type in (N'U')) | ||
RETURN | ||
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'{0}') AND type in (N'U')) | ||
BEGIN | ||
CREATE TABLE {0}( | ||
[Id] [uniqueidentifier] NOT NULL, | ||
[CorrelationId] [varchar](255), | ||
[ReplyToAddress] [varchar](255), | ||
[Recoverable] [bit] NOT NULL, | ||
[Expires] [datetime], | ||
[Headers] [varchar](max) NOT NULL, | ||
[Body] [varbinary](max), | ||
[RowVersion] [bigint] IDENTITY(1,1) NOT NULL | ||
); | ||
EXEC sp_getapplock @Resource = '{0}_lock', @LockMode = 'Exclusive' | ||
CREATE CLUSTERED INDEX [Index_RowVersion] ON {0} | ||
( | ||
[RowVersion] | ||
) | ||
IF EXISTS ( | ||
SELECT * | ||
FROM sys.objects | ||
WHERE object_id = OBJECT_ID(N'{0}') | ||
AND type in (N'U')) | ||
BEGIN | ||
EXEC sp_releaseapplock @Resource = '{0}_lock' | ||
RETURN | ||
END | ||
CREATE NONCLUSTERED INDEX [Index_Expires] ON {0} | ||
( | ||
[Expires] | ||
) | ||
INCLUDE | ||
( | ||
[Id], | ||
[RowVersion] | ||
) | ||
END | ||
CREATE TABLE {0} ( | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
SzymonPobiega
Author
Member
|
||
Id uniqueidentifier NOT NULL, | ||
CorrelationId varchar(255), | ||
ReplyToAddress varchar(255), | ||
Recoverable bit NOT NULL, | ||
Expires datetime, | ||
Headers nvarchar(max) NOT NULL, | ||
Body varbinary(max), | ||
RowVersion bigint IDENTITY(1,1) NOT NULL | ||
); | ||
EXEC sp_releaseapplock @Resource = '{0}_lock' | ||
END"; | ||
CREATE CLUSTERED INDEX Index_RowVersion ON {0} | ||
( | ||
RowVersion | ||
) | ||
CREATE NONCLUSTERED INDEX Index_Expires ON {0} | ||
( | ||
Expires | ||
) | ||
INCLUDE | ||
( | ||
Id, | ||
RowVersion | ||
) | ||
WHERE | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
SzymonPobiega
Author
Member
|
||
Expires IS NOT NULL | ||
EXEC sp_releaseapplock @Resource = '{0}_lock'"; | ||
} | ||
} |
2 comments
on commit 0ea01eb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two small questions :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK thanks, LGTM
Any reason to remove square brackets? Or just refactoring?