squash a bunch of commits
This commit is contained in:
24
Shogi.Database/Session/Stored Procedures/CreateSession.sql
Normal file
24
Shogi.Database/Session/Stored Procedures/CreateSession.sql
Normal file
@@ -0,0 +1,24 @@
|
||||
CREATE PROCEDURE [session].[CreateSession]
|
||||
@SessionName [session].[SessionName],
|
||||
@Player1Name [user].[UserName],
|
||||
@InitialBoardStateDocument [session].[JsonDocument]
|
||||
AS
|
||||
BEGIN
|
||||
|
||||
SET NOCOUNT ON
|
||||
SET XACT_ABORT ON
|
||||
|
||||
BEGIN TRANSACTION
|
||||
INSERT INTO [session].[Session] ([Name], Player1Id)
|
||||
SELECT
|
||||
@SessionName,
|
||||
Id
|
||||
FROM [user].[User]
|
||||
WHERE [Name] = @Player1Name;
|
||||
|
||||
INSERT INTO [session].[BoardState] (Document, SessionId)
|
||||
VALUES
|
||||
(@InitialBoardStateDocument, SCOPE_IDENTITY());
|
||||
COMMIT
|
||||
|
||||
END
|
||||
Reference in New Issue
Block a user