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.

107 lines
1.9 KiB

  1. SET QUOTED_IDENTIFIER ON
  2. GO
  3. SET ANSI_NULLS ON
  4. GO
  5. CREATE PROCEDURE sp_ResolveBucket
  6. @BucketId varchar(100),
  7. @BugId int ,
  8. @Description varchar(4000),
  9. @SolvedBy varchar(20),
  10. @Comment varchar (1000),
  11. @OSVersion varchar (30)
  12. AS
  13. BEGIN
  14. DECLARE @iBucket AS int
  15. DECLARE @TodaysDate AS DATETIME
  16. SET @TodaysDate = GETDATE()
  17. SELECT @iBucket = iBucket FROM BucketToInt
  18. WHERE BucketId = @BucketId
  19. -- BugId != 0 or description not null
  20. -- Insert it into RaidBugs
  21. IF (@BugId <> 0 OR @Description <> '')
  22. BEGIN
  23. DELETE FROM RaidBugs
  24. WHERE iBucket = @iBucket
  25. INSERT INTO RaidBugs
  26. VALUES (@iBucket, @BugId)
  27. END
  28. -- Insert it into SolvedIssues
  29. IF (@Description <> '')
  30. BEGIN
  31. DECLARE @SolId AS INT
  32. SELECT @SolId = SolId FROM SolutionsMap WHERE iBucket = @iBucket
  33. DELETE FROM SolutionsMap
  34. WHERE iBucket = @iBucket
  35. IF @SolId <> NULL
  36. BEGIN
  37. DELETE FROM Solutions WHERE SolId = @SolId
  38. END
  39. INSERT INTO Solutions
  40. VALUES (@TodaysDate, @Description,@SolvedBy, 0, @OSVersion)
  41. SELECT @SolId = SolId FROM Solutions WHERE SolveDate = @TodaysDate AND SolvedBy = @SolvedBy
  42. INSERT INTO SolutionsMap
  43. VALUES ( @SolId, @iBucket)
  44. END
  45. -- Add the comment
  46. IF (@Comment <> '')
  47. BEGIN
  48. DECLARE @CommentId AS INT
  49. SELECT @CommentId = CommentId FROM CommentsMap WHERE iBucket = @iBucket
  50. DELETE FROM CommentsMap
  51. WHERE iBucket = @iBucket
  52. IF @CommentId <> NULL
  53. BEGIN
  54. DELETE FROM Comentss WHERE CommentId = @CommentId
  55. END
  56. INSERT INTO Comments VALUES (@TodaysDate,@SolvedBy, @Comment)
  57. SELECT @CommentId = CommentId FROM Comments WHERE EntryDate = @TodaysDate AND CommentBy = @SolvedBy
  58. INSERT INTO CommentsMap
  59. VALUES ( @CommentId, @iBucket)
  60. END
  61. END
  62. GO
  63. SET QUOTED_IDENTIFIER OFF
  64. GO
  65. SET ANSI_NULLS ON
  66. GO