-
Notifications
You must be signed in to change notification settings - Fork 687
/
LogicAppStoredProcedures.sql
58 lines (43 loc) · 1.18 KB
/
LogicAppStoredProcedures.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[LogicAppGetUserChainIdentifierFromEmailAddress]
(
@UserEmailAddress NVARCHAR(255)
)
AS
BEGIN
Select ucm.ChainIdentifier from
[vwUser] u inner join UserChainMapping ucm on u.Id = ucm.ID
Where u.EmailAddress = @UserEmailAddress
END
GO
CREATE PROCEDURE [dbo].[LogicAppGetUserChainIdentifierFromName]
(
@FirstName NVARCHAR(256),
@LastName NVARCHAR(64)
)
AS
BEGIN
Select ucm.ChainIdentifier from
[vwUser] u inner join UserChainMapping ucm on u.Id = ucm.ID
Where u.FirstName = @FirstName and u.LastName = @LastName
END
Go
CREATE PROCEDURE [dbo].[LogicAppGetContractCreationDetails]
(
@ApplicationName NVARCHAR(50),
@WorkflowName NVARCHAR(50)
)
AS
BEGIN
Select Top 1 vw.ApplicationName,vw.WorkflowName,cc.ArtifactBlobStorageURL as ContractCodeArtifactBlobStorageURL,cc.LedgerId as ChainId, c.Id as ConnectionId
From
vwWorkflow vw
inner join ContractCode cc on vw.ApplicationId = cc.ApplicationId
inner join Connection c on c.LedgerId = cc.LedgerId
where vw.ApplicationName = @ApplicationName and vw.WorkflowName= @WorkflowName
Order By vw.ApplicationUploadedDtTm
END
Go