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.

91 lines
1.6 KiB

  1. SET QUOTED_IDENTIFIER ON
  2. GO
  3. SET ANSI_NULLS ON
  4. GO
  5. CREATE PROCEDURE sp_RetriageCrash
  6. @ip_CrashId bigint,
  7. @ip_BucketId varchar(100),
  8. @ip_FollowUp varchar(50)
  9. AS
  10. BEGIN
  11. DECLARE @b_BucketExists int
  12. DECLARE @i_iBucket int
  13. -- Check if crash exists
  14. IF NOT EXISTS
  15. (SELECT CrashId FROM CrashInstances WHERE CrashId = @ip_CrashId)
  16. BEGIN
  17. return 1
  18. END
  19. -- Insert the Bucket into bucket table
  20. SET @b_BucketExists = 1
  21. IF NOT EXISTS
  22. (SELECT BucketId FROM BucketToInt WHERE BucketId = @ip_BucketId)
  23. BEGIN
  24. SET @b_BucketExists = 0
  25. INSERT BucketToInt VALUES (@ip_BucketId)
  26. END
  27. SELECT @i_iBucket = iBucket FROM BucketToInt WHERE BucketId = @ip_BucketId
  28. -- Update the follouwp
  29. IF NOT EXISTS
  30. (SELECT iBucket FROM Followups WHERE iBucket = @i_iBucket)
  31. BEGIN
  32. INSERT Followups VALUES (@i_iBucket,@ip_FollowUp)
  33. END
  34. ELSE IF NOT EXISTS (SELECT iBucket FROM Followups
  35. WHERE iBucket = @i_iBucket AND Followup = @ip_FollowUp)
  36. BEGIN
  37. -- Bucket used to have different followup
  38. SET @b_BucketExists = 2
  39. UPDATE Followups
  40. SET Followup = @ip_FollowUp
  41. WHERE iBucket = @i_iBucket
  42. END
  43. -- Insert the Bucket into bucketmapping table
  44. IF EXISTS
  45. (SELECT iBucket FROM BucketToCrash WHERE CrashId = @ip_CrashId)
  46. BEGIN
  47. DELETE FROM BucketToCrash WHERE CrashId = @ip_CrashId
  48. END
  49. IF NOT EXISTS
  50. (SELECT iBucket FROM BucketToCrash WHERE iBucket = @i_iBucket AND CrashId = @ip_CrashId)
  51. BEGIN
  52. INSERT BucketToCrash VALUES (@ip_CrashId, @i_iBucket)
  53. END
  54. RETURN 0
  55. END
  56. GO
  57. SET QUOTED_IDENTIFIER OFF
  58. GO
  59. SET ANSI_NULLS ON
  60. GO