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.

260 lines
7.7 KiB

  1. /****** Object: Stored Procedure dbo.OCAV3_ChangeIncidentViewState Script Date: 5/17/2002 4:44:42 PM ******/
  2. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[OCAV3_ChangeIncidentViewState]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  3. drop procedure [dbo].[OCAV3_ChangeIncidentViewState]
  4. GO
  5. /****** Object: Stored Procedure dbo.OCAV3_GetCustomerID Script Date: 5/17/2002 4:44:42 PM ******/
  6. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[OCAV3_GetCustomerID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  7. drop procedure [dbo].[OCAV3_GetCustomerID]
  8. GO
  9. /****** Object: Stored Procedure dbo.OCAV3_GetCustomerIssues Script Date: 5/17/2002 4:44:42 PM ******/
  10. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[OCAV3_GetCustomerIssues]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  11. drop procedure [dbo].[OCAV3_GetCustomerIssues]
  12. GO
  13. /****** Object: Stored Procedure dbo.OCAV3_RemoveCustomerIncident Script Date: 5/17/2002 4:44:42 PM ******/
  14. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[OCAV3_RemoveCustomerIncident]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  15. drop procedure [dbo].[OCAV3_RemoveCustomerIncident]
  16. GO
  17. /****** Object: Stored Procedure dbo.OCAV3_SetUserComments Script Date: 5/17/2002 4:44:42 PM ******/
  18. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[OCAV3_SetUserComments]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  19. drop procedure [dbo].[OCAV3_SetUserComments]
  20. GO
  21. /****** Object: Stored Procedure dbo.OCAV3_SetUserData Script Date: 5/17/2002 4:44:42 PM ******/
  22. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[OCAV3_SetUserData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  23. drop procedure [dbo].[OCAV3_SetUserData]
  24. GO
  25. SET QUOTED_IDENTIFIER OFF
  26. GO
  27. SET ANSI_NULLS OFF
  28. GO
  29. --5/24 SOlson - Added the always update the customer email whenever we get the customer ID
  30. CREATE PROCEDURE OCAV3_GetCustomerID(
  31. @PPID bigint,
  32. @Email nvarchar(128)
  33. )
  34. AS
  35. SELECT CustomerID FROM Customer WHERE PassportID = @PPID
  36. UPDATE Customer SET Email = @Email WHERE PassportID = @PPID
  37. GO
  38. SET QUOTED_IDENTIFIER OFF
  39. GO
  40. SET ANSI_NULLS ON
  41. GO
  42. SET QUOTED_IDENTIFIER OFF
  43. GO
  44. SET ANSI_NULLS OFF
  45. GO
  46. -- 5/29/2002 Solson : Switch this sproc to use the BucketID value instead of the int bucket value
  47. CREATE PROCEDURE OCAV3_GetCustomerIssues(
  48. @CustomerID int
  49. )
  50. AS
  51. SELECT Created, [Description], TrackID, sBucket, CustomerId, CASE
  52. WHEN a.SolutionID is not NULL THEN 0
  53. WHEN a.SolutionID is NULL and B.SolutionID is not null THEN -1 --assign it a -1 if a general solution
  54. WHEN A.SolutionID is NULL and B.SolutionID is NULL then -2 --assing it a -2 if no solution period
  55. END AS "State",
  56. CASE
  57. WHEN A.SolutionID IS NOT NULL THEN A.SolutionID
  58. WHEN A.SolutionID is NULL and B.SolutionID IS NOT NULL THEN B.SolutionID
  59. WHEN A.SolutionID IS NULL AND B.SolutionID IS NULL THEN 0
  60. END AS "SolutionID"
  61. FROM Incident
  62. LEFT JOIN CrashDB3.dbo.BucketToInt as sBtoI on sBtoI.iBucket = sBucket
  63. LEFT JOIN CrashDB3.dbo.BucketToInt as gBtoI on gBtoI.iBucket = gBucket
  64. LEFT Join Solutions3.dbo.SolvedBuckets as A on sBtoI.BucketID=A.BucketID
  65. LEFT JOIN Solutions3.dbo.SolvedBuckets as B on gBtoI.BucketID=B.BucketID
  66. where CustomerID = @CustomerID
  67. order by Created desc
  68. SET QUOTED_IDENTIFIER OFF
  69. GO
  70. SET ANSI_NULLS ON
  71. GO
  72. SET QUOTED_IDENTIFIER OFF
  73. GO
  74. SET ANSI_NULLS OFF
  75. GO
  76. /****** Object: Stored Procedure dbo.OCAV3_RemoveCustomerIncident Script Date: 5/17/2002 4:44:42 PM ******/
  77. CREATE PROCEDURE OCAV3_RemoveCustomerIncident(
  78. @CustomerID int,
  79. @RecordNumbers varchar(4000)
  80. ) AS
  81. EXEC( 'DELETE FROM INCIDENT WHERE CustomerID = ' + @CustomerID + 'and TrackID in ( ' + @RecordNumbers + ')' )
  82. GO
  83. SET QUOTED_IDENTIFIER OFF
  84. GO
  85. SET ANSI_NULLS ON
  86. GO
  87. SET QUOTED_IDENTIFIER ON
  88. GO
  89. SET ANSI_NULLS OFF
  90. GO
  91. /****** Object: Stored Procedure dbo.OCAV3_SetUserComments Script Date: 5/17/2002 4:44:43 PM ******/
  92. CREATE PROCEDURE OCAV3_SetUserComments(
  93. @SolutionID int,
  94. @bUnderstand bit,
  95. @bHelped bit,
  96. @szComment nvarchar(256)
  97. ) AS
  98. INSERT INTO SurveyResults ( SolutionID, bUnderstand, bHelped, Comment ) VALUES ( @SolutionID, @bUnderstand, @bHelped, @szComment )
  99. GO
  100. SET QUOTED_IDENTIFIER OFF
  101. GO
  102. SET ANSI_NULLS ON
  103. GO
  104. SET QUOTED_IDENTIFIER OFF
  105. GO
  106. SET ANSI_NULLS OFF
  107. GO
  108. -- 5/24 SOlson : Changed the else clause in the first if to always update the customer email address.
  109. CREATE PROCEDURE OCAV3_SetUserData(
  110. @PassportID bigint,
  111. @Lang varchar( 4 ),
  112. @Email nvarchar(128),
  113. @GUID uniqueidentifier,
  114. @Description nvarchar(256)
  115. )
  116. AS
  117. /*
  118. ERROR CASES:
  119. -6 = That we have searched the crashdb and the guid that was supplied does not exist
  120. -7 = Means that there is already a guid with the same value in the customer incident table.
  121. so someone has already submitted a dump with this guid and is tracking it.
  122. */
  123. SET NOCOUNT ON
  124. DECLARE @CustomerID int
  125. DECLARE @gBucket int
  126. DECLARE @sBucket int
  127. IF NOT EXISTS ( SELECT * FROM Customer WHERE PassportID = @PassportID )
  128. BEGIN
  129. INSERT INTO Customer ( PassportID, Lang, Email ) VALUES ( @PassportID, @Lang, @Email )
  130. SELECT @CustomerID= @@IDENTITY
  131. END
  132. ELSE
  133. BEGIN
  134. UPDATE Customer SET Email = @Email WHERE PassportID = @PassportID
  135. SELECT @CustomerID = CustomerID FROM Customer WHERE PassportID = @PassportID
  136. END
  137. -- We want the GUID to not exist in the Incident table. . check it first.
  138. IF EXISTS ( SELECT * FROM Incident WHERE GUID=@GUID )
  139. BEGIN
  140. -- If weve hit here, then the GUID already exists in the customer incident table.
  141. SELECT -7 as CustomerID
  142. END
  143. ELSE
  144. BEGIN
  145. IF EXISTS ( SELECT * FROM CrashDB3.dbo.CrashInstances WHERE GUID = @GUID )
  146. BEGIN
  147. SELECT @gBucket = gBucket, @sBucket = sBucket FROM CrashDB3.dbo.CrashInstances WHERE GUID = @GUID
  148. INSERT INTO Incident ( CustomerID, GUID, Created, Description, sBucket, gBucket ) VALUES ( @CustomerID, @GUID, GetDate(), @Description, @sBucket, @gBucket )
  149. SELECT CustomerID FROM Customer WHERE CustomerID = @CustomerID
  150. END
  151. ELSE
  152. BEGIN
  153. -- Failure case. Means the dump doesn't exist yet in the crashdb. Or the guid is fake
  154. SELECT -6 as CustomerID
  155. END
  156. END
  157. SET NOCOUNT OFF
  158. GO
  159. SET QUOTED_IDENTIFIER OFF
  160. GO
  161. SET ANSI_NULLS ON
  162. GO
  163. SET QUOTED_IDENTIFIER ON
  164. GO
  165. SET ANSI_NULLS OFF
  166. GO
  167. /****** Object: Stored Procedure dbo.OCAV3_SetUserReproSteps Script Date: 2002/06/04 13:03:47 ******/
  168. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[OCAV3_SetUserReproSteps]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  169. drop procedure [dbo].[OCAV3_SetUserReproSteps]
  170. GO
  171. SET QUOTED_IDENTIFIER ON
  172. GO
  173. SET ANSI_NULLS OFF
  174. GO
  175. /****** Object: Stored Procedure dbo.OCAV3_SetUserReproSteps Script Date: 2002/06/04 13:03:47 ******/
  176. CREATE PROCEDURE OCAV3_SetUserReproSteps (
  177. @SolutionID int,
  178. @ReproSteps nvarchar(255)
  179. ) AS
  180. DECLARE @BucketID varchar(256)
  181. SELECT @BucketID = BucketID FROM Solutions3.dbo.SolvedBuckets WHERE SolutionID = @SolutionID
  182. INSERT INTO ReproSteps ( BucketID, ReproSteps ) VALUES ( @BucketID, @ReproSteps )
  183. GO
  184. SET QUOTED_IDENTIFIER OFF
  185. GO
  186. SET ANSI_NULLS ON
  187. GO
  188. GRANT EXECUTE ON [dbo].[OCAV3_RemoveCustomerIncident] TO [WEB_RW]
  189. GO
  190. GRANT EXECUTE ON [dbo].[OCAV3_GetCustomerID] TO [Web_RO]
  191. GO
  192. GRANT EXECUTE ON [dbo].[OCAV3_GetCustomerIssues] TO [Web_RO]
  193. GO
  194. GRANT EXECUTE ON [dbo].[OCAV3_GetCustomerIssues] TO [WEB_RW]
  195. GO
  196. GRANT EXECUTE ON [dbo].[OCAV3_SetUserComments] TO [WEB_RW]
  197. GO
  198. GRANT EXECUTE ON [dbo].[OCAV3_SetUserData] TO [WEB_RW]
  199. GO
  200. GRANT EXECUTE ON [dbo].[OCAV3_SetUserReproSteps] TO [WEB_RW]
  201. GO