Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

120 lines
3.2 KiB

  1. -- =============================================
  2. -- Name: net_getPUIDForBusinessEntity
  3. -- =============================================
  4. IF EXISTS (SELECT name FROM sysobjects WHERE name = N'net_getPUIDForBusinessEntity' AND type = 'P')
  5. DROP PROCEDURE net_getPUIDForBusinessEntity
  6. GO
  7. CREATE PROCEDURE net_getPUIDForBusinessEntity
  8. @businessKey uniqueidentifier -- the guid of the businessEntity
  9. WITH ENCRYPTION
  10. AS
  11. BEGIN
  12. SELECT [UP].[PUID]
  13. FROM [UDC_businessEntities] BE JOIN [UDO_publishers] UP ON [BE].[publisherID] = [UP].[publisherID]
  14. WHERE [BE].[businessKey] = @businessKey
  15. END -- net_getPUIDForBusinessEntity
  16. GO
  17. -- =============================================
  18. -- Name: net_find_businessKeysWithDiscoveryURLs
  19. -- =============================================
  20. IF EXISTS (SELECT name FROM sysobjects WHERE name = N'net_find_businessKeysWithDiscoveryURLs' AND type = 'P')
  21. DROP PROCEDURE net_find_businessKeysWithDiscoveryURLs
  22. GO
  23. CREATE PROCEDURE net_find_businessKeysWithDiscoveryURLs
  24. WITH ENCRYPTION
  25. AS
  26. BEGIN
  27. SELECT DISTINCT [BE].[businessKey]
  28. FROM [UDC_discoveryURLs] UD
  29. JOIN [UDC_businessEntities] BE ON ([UD].[businessID]) = ([BE].[businessID])
  30. WHERE dbo.isReplPublisher( [BE].[publisherID] ) = 0
  31. END
  32. GO
  33. -- =============================================
  34. -- Name: net_find_changeRecordsByChangeType
  35. -- =============================================
  36. IF EXISTS (SELECT name FROM sysobjects WHERE name = N'net_find_changeRecordsByChangeType' AND type = 'P')
  37. DROP PROCEDURE net_find_changeRecordsByChangeType
  38. GO
  39. CREATE PROCEDURE net_find_changeRecordsByChangeType
  40. @contextID uniqueidentifier, -- contextID of current find operation
  41. @operatorKey uniqueidentifier, -- operatorKey for source operator node
  42. @entityKey uniqueidentifier, -- the guid of the entity
  43. @changeTypeID tinyint, -- the type of change record
  44. @rows bigint OUTPUT -- rows added to UDS_findResults
  45. WITH ENCRYPTION
  46. AS
  47. BEGIN
  48. DECLARE
  49. @error int,
  50. @context nvarchar(4000),
  51. @operatorID bigint,
  52. @publisherID bigint,
  53. @i int
  54. SET @rows = 0
  55. SET @operatorID = dbo.operatorID(@operatorKey)
  56. IF @operatorID IS NULL
  57. BEGIN
  58. SET @error = 60150 -- E_unknownUser
  59. SET @context = 'operatorKey = ' + dbo.UUIDSTR(@operatorKey)
  60. GOTO errorLabel
  61. END
  62. SET @publisherID = dbo.getOperatorPublisherID(@operatorID)
  63. IF (@operatorID = dbo.currentOperatorID())
  64. BEGIN
  65. -- Find changeRecords for the local operator
  66. INSERT [UDS_replResults] (
  67. [contextID],
  68. [seqNo])
  69. SELECT
  70. @contextID,
  71. [seqNo]
  72. FROM
  73. [UDO_changeLog]
  74. WHERE
  75. ([changeTypeID] = @changeTypeID) AND
  76. ([entityKey] = @entityKey) AND
  77. ([USN] IS NULL)
  78. ORDER BY
  79. [seqNo] ASC
  80. END
  81. ELSE
  82. BEGIN
  83. INSERT [UDS_replResults] (
  84. [contextID],
  85. [seqNo])
  86. SELECT
  87. @contextID,
  88. [seqNo]
  89. FROM
  90. [UDO_changeLog]
  91. WHERE
  92. ([changeTypeID] = @changeTypeID) AND
  93. ([entityKey] = @entityKey) AND
  94. ([publisherID] = @publisherID)
  95. ORDER BY
  96. [seqNo] ASC
  97. END
  98. SET @rows = @@ROWCOUNT
  99. RETURN 0
  100. errorLabel:
  101. RAISERROR (@error, 16, 1, @context)
  102. RETURN 1
  103. END -- net_find_changeRecordsByEntity
  104. GO