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.

1786 lines
42 KiB

  1. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_AddBucketFollowup]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  2. drop procedure [dbo].[sp_AddBucketFollowup]
  3. GO
  4. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_AddCrashInstance2]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  5. drop procedure [dbo].[sp_AddCrashInstance2]
  6. GO
  7. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_AddDriver]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  8. drop procedure [dbo].[sp_AddDriver]
  9. GO
  10. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_AddToDrBin]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  11. drop procedure [dbo].[sp_AddToDrBin]
  12. GO
  13. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_CategorizeBuckets]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  14. drop procedure [dbo].[sp_CategorizeBuckets]
  15. GO
  16. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_CheckCrashExists]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  17. drop procedure [dbo].[sp_CheckCrashExists]
  18. GO
  19. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_DeleteSolution]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  20. drop procedure [dbo].[sp_DeleteSolution]
  21. GO
  22. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_EmptyBuckets]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  23. drop procedure [dbo].[sp_EmptyBuckets]
  24. GO
  25. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_GetIntBucket]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  26. drop procedure [dbo].[sp_GetIntBucket]
  27. GO
  28. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_GetProblems]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  29. drop procedure [dbo].[sp_GetProblems]
  30. GO
  31. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_HexToInt]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  32. drop procedure [dbo].[sp_HexToInt]
  33. GO
  34. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_ListBucket]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  35. drop procedure [dbo].[sp_ListBucket]
  36. GO
  37. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_LookupBucket]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  38. drop procedure [dbo].[sp_LookupBucket]
  39. GO
  40. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_NewIssues]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  41. drop procedure [dbo].[sp_NewIssues]
  42. GO
  43. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_NewIssuesThisWeek]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  44. drop procedure [dbo].[sp_NewIssuesThisWeek]
  45. GO
  46. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_NewIssuesToday]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  47. drop procedure [dbo].[sp_NewIssuesToday]
  48. GO
  49. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_PrivateCleanupCrash]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  50. drop procedure [dbo].[sp_PrivateCleanupCrash]
  51. GO
  52. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_RetriageCrash]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  53. drop procedure [dbo].[sp_RetriageCrash]
  54. GO
  55. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_SearchDb]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  56. drop procedure [dbo].[sp_SearchDb]
  57. GO
  58. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_SendMailForBucket]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  59. drop procedure [dbo].[sp_SendMailForBucket]
  60. GO
  61. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_SolvedIssuesThisWeek]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  62. drop procedure [dbo].[sp_SolvedIssuesThisWeek]
  63. GO
  64. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_SolvedIssuesToday]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  65. drop procedure [dbo].[sp_SolvedIssuesToday]
  66. GO
  67. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_CompleteRetriageRequest]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  68. drop procedure [dbo].[DBGP_CompleteRetriageRequest]
  69. GO
  70. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_CreateRetriageRequest]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  71. drop procedure [dbo].[DBGP_CreateRetriageRequest]
  72. GO
  73. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_ApproveRetriageRequest]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  74. drop procedure [dbo].[DBGP_ApproveRetriageRequest]
  75. GO
  76. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_ClearPoolCorruption]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  77. drop procedure [dbo].[DBGP_ClearPoolCorruption]
  78. GO
  79. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_BuildDebugPortalTables]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  80. drop procedure [dbo].[DBGP_BuildDebugPortalTables]
  81. GO
  82. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_SetPoolCorruption]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  83. drop procedure [dbo].[DBGP_SetPoolCorruption]
  84. GO
  85. SET QUOTED_IDENTIFIER OFF
  86. GO
  87. SET ANSI_NULLS ON
  88. GO
  89. /****** Object: Stored Procedure dbo.sp_AddBucketFollowup Script Date: 12/19/2001 2:06:04 PM ******/
  90. -- Update StoreProc to add buckets
  91. CREATE PROCEDURE sp_AddBucketFollowup
  92. @i_BucketStr varchar(100),
  93. @i_FollowupStr varchar(50)
  94. AS
  95. BEGIN
  96. DECLARE @iBucket int
  97. DECLARE @iFollowup int
  98. IF NOT EXISTS (SELECT * FROM FollowupIds WHERE Followup = @i_FollowupStr)
  99. BEGIN
  100. INSERT INTO FollowupIds VALUES (@i_FollowupStr)
  101. SELECT @iFollowup = @@IDENTITY
  102. END
  103. ELSE
  104. BEGIN
  105. SELECT @iFollowup = iFollowup FROM FollowupIds WHERE Followup = @i_FollowupStr
  106. END
  107. SELECT @iBucket = iBucket FROM BucketToInt WHERE BucketId = @i_BucketStr
  108. IF @iBucket IS NOT NULL
  109. BEGIN
  110. -- Bucket exists in bucket table
  111. IF NOT EXISTS (SELECT iBucket FROM BucketToInt b
  112. WHERE BucketId = @i_BucketStr AND b.iFollowup = @iFollowup)
  113. BEGIN
  114. -- Update followup
  115. UPDATE BucketToInt
  116. SET iFollowup = @iFollowup
  117. WHERE iBucket = @iBucket
  118. END
  119. END
  120. ELSE
  121. BEGIN
  122. INSERT INTO BucketToInt (BucketId, iFollowup)
  123. VALUES (@i_BucketStr, @iFollowup)
  124. SELECT @iBucket = @@IDENTITY
  125. END
  126. -- SELECT @i_BucketStr AS BucketId, @iBucket AS iBucket, @iFollowup AS iFollowup
  127. -- select * from buckettoint where bucketid = @i_BucketStr
  128. END
  129. GO
  130. SET QUOTED_IDENTIFIER OFF
  131. GO
  132. SET ANSI_NULLS ON
  133. GO
  134. SET QUOTED_IDENTIFIER OFF
  135. GO
  136. SET ANSI_NULLS ON
  137. GO
  138. /****** Object: Stored Procedure dbo.sp_AddCrashInstance2 Script Date: 12/14/2001 5:00:04 PM ******/
  139. /*
  140. Adds a crash instance to CrashDb
  141. Returns isBucket, igBucket if successfull
  142. */
  143. CREATE PROCEDURE sp_AddCrashInstance2 (
  144. @ip_retriageBucket bit,
  145. @ip_BucketId varchar(100),
  146. @ip_Path varchar(256),
  147. @ip_FollowUp varchar(50),
  148. @ip_BuildNo int,
  149. @ip_Source int,
  150. @ip_CpuId bigint,
  151. @ip_OverClocked bit,
  152. @ip_IncidentId bigint,
  153. @ip_gBucketId varchar(100),
  154. @ip_DriverName varchar (100),
  155. @ip_Type int
  156. )
  157. AS
  158. BEGIN
  159. DECLARE @i_sBucket int
  160. DECLARE @i_gBucket int
  161. DECLARE @i_Followup int
  162. DECLARE @i_OldFollowup int
  163. DECLARE @i_DriverName int
  164. DECLARE @i_OldDriverName int
  165. SET NOCOUNT ON
  166. -- Find the specific bucket
  167. SELECT @i_sBucket = iBucket,
  168. @i_OldFollowup = iFollowup,
  169. @i_OldDriverName = iDriverName
  170. FROM BucketToInt WHERE BucketId = @ip_BucketId
  171. -- If the specifc bucket does not exist, or we want to update the
  172. -- fields
  173. IF ( (@i_sBucket IS NULL) OR (@ip_retriageBucket = 1) )
  174. BEGIN
  175. SELECT @i_Followup = iFollowup FROM FollowupIds
  176. WHERE Followup = @ip_FollowUp
  177. --get (or add) the followup information.
  178. -- IF NOT EXISTS (SELECT * FROM FollowupIds
  179. -- WHERE Followup = @ip_FollowUp)
  180. if (@i_Followup is null)
  181. BEGIN
  182. INSERT INTO FollowupIds VALUES (@ip_FollowUp, NULL)
  183. SELECT @i_Followup = @@IDENTITY
  184. END
  185. -- ELSE
  186. -- BEGIN
  187. -- SELECT @i_Followup = iFollowup FROM FollowupIds
  188. -- WHERE Followup = @ip_FollowUp
  189. -- END
  190. --get (or add) the driver name.
  191. SELECT @i_DriverName = iDriverName FROM DrNames
  192. WHERE DriverName = @ip_DriverName
  193. if (@i_DriverName is null)
  194. -- IF NOT EXISTS (SELECT * FROM DrNames
  195. -- WHERE DriverName = @ip_DriverName)
  196. BEGIN
  197. INSERT INTO DrNames (DriverName)
  198. VALUES (@ip_DriverName)
  199. SELECT @i_DriverName = @@IDENTITY
  200. END
  201. -- ELSE
  202. -- BEGIN
  203. -- SELECT @i_DriverName = iDriverName FROM DrNames
  204. -- WHERE DriverName = @ip_DriverName
  205. -- END
  206. END
  207. IF ( @i_sBucket IS NULL)
  208. BEGIN
  209. INSERT INTO BucketToInt (BucketId, iFollowup, iDriverName, Platform) -- added platfrom param sbeer 02/20/02
  210. VALUES (@ip_BucketId, @i_Followup, @i_DriverName, @ip_Type)
  211. SELECT @i_sBucket = @@IDENTITY
  212. END
  213. ELSE
  214. BEGIN
  215. -- Bucket exists in bucket table. Update it if necessary
  216. IF @ip_RetriageBucket = 1
  217. BEGIN
  218. IF ( (@i_OldFollowup is null) or (@i_OldDriverName is null) or (@i_OldFollowup != @i_Followup) OR
  219. (@i_OldDriverName != @i_DriverName) )
  220. BEGIN
  221. UPDATE BucketToInt
  222. SET iFollowup = @i_Followup, iDriverName = @i_DriverName, Platform = @ip_Type -- added platfrom param sbeer 02/20/02
  223. WHERE iBucket = @i_sBucket
  224. END
  225. END
  226. END
  227. -- Add generic bucket
  228. SELECT @i_gBucket = iBucket FROM BucketToInt
  229. WHERE BucketId = @ip_gBucketId
  230. IF (@i_gBucket IS NULL)
  231. BEGIN
  232. INSERT BucketToInt ( BucketID, iBucket, iFollowUp,Platform) VALUES (@ip_gBucketId,0,0,@ip_Type) --added explicit column names solson 02/14/02
  233. SELECT @i_gBucket = @@IDENTITY
  234. END
  235. -- Add the Crash Instance to the crash instance table and the mapping
  236. -- table
  237. IF NOT EXISTS (SELECT IncidentId FROM CrashInstances
  238. WHERE IncidentId = @ip_IncidentId)
  239. BEGIN
  240. INSERT INTO CrashInstances
  241. VALUES ( @ip_Path,
  242. @ip_BuildNo,
  243. @ip_CpuId,
  244. @ip_IncidentId,
  245. @i_sBucket,
  246. @i_gBucket,
  247. GetDate(),
  248. @ip_Source)
  249. END
  250. ELSE
  251. BEGIN
  252. IF (@ip_retriageBucket = 1)
  253. BEGIN
  254. UPDATE CrashInstances
  255. SET sBucket = @i_sBucket, gBucket = @i_gBucket
  256. WHERE IncidentId = @ip_IncidentId
  257. END
  258. END
  259. SET NOCOUNT OFF
  260. SELECT @i_sBucket AS sBucket, @i_gBucket AS gBucket
  261. END
  262. GO
  263. SET QUOTED_IDENTIFIER OFF
  264. GO
  265. SET ANSI_NULLS ON
  266. GO
  267. SET QUOTED_IDENTIFIER ON
  268. GO
  269. SET ANSI_NULLS ON
  270. GO
  271. /****** Object: Stored Procedure dbo.sp_AddDriver Script Date: 12/19/2001 2:06:04 PM ******/
  272. CREATE PROCEDURE sp_AddDriver (
  273. @i_DriverName varchar(100),
  274. @i_Bucket int
  275. )
  276. AS
  277. BEGIN
  278. DECLARE @BinId int
  279. IF NOT EXISTS (SELECT * FROM DrNames WHERE BinName = @i_DriverName)
  280. BEGIN
  281. INSERT INTO DrNames VALUES (@i_DriverName)
  282. END
  283. SELECT @BinId = BinId FROM DrNames WHERE BinName = @i_DriverName
  284. IF NOT EXISTS (SELECT * FROM DriverMap WHERE iBucket = @i_Bucket)
  285. BEGIN
  286. INSERT INTO DriverMap VALUES ( @i_Bucket, @BinId )
  287. END
  288. ELSE
  289. BEGIN
  290. UPDATE DriverMap
  291. SET BinId = @BinId
  292. WHERE iBucket = @i_Bucket
  293. END
  294. END
  295. GO
  296. SET QUOTED_IDENTIFIER OFF
  297. GO
  298. SET ANSI_NULLS ON
  299. GO
  300. SET QUOTED_IDENTIFIER ON
  301. GO
  302. SET ANSI_NULLS ON
  303. GO
  304. /****** Object: Stored Procedure dbo.sp_AddToDrBin Script Date: 12/19/2001 2:06:04 PM ******/
  305. /****** Object: Stored Procedure dbo.sp_AddToDrBin Script Date: 11/7/2001 3:53:58 AM ******/
  306. CREATE PROC sp_AddToDrBin (
  307. @i_CIDNAME VARCHAR(20),
  308. @i_BinName VARCHAR(100),
  309. @i_BinStamp INT
  310. ) AS
  311. BEGIN
  312. DECLARE @t_CID BIGINT
  313. DECLARE @t_CIDName VARCHAR(20)
  314. DECLARE @t_BinID BIGINT
  315. DECLARE @t_BinName VARCHAR(100)
  316. -- Insert record into table DriversUsed
  317. IF NOT EXISTS
  318. (SELECT CIDName FROM DriverUsed WHERE CIDName = @i_CIDName)
  319. BEGIN
  320. INSERT dbo.DriverUsed(CIDName) VALUES (@i_CIDName)
  321. END
  322. -- Insert record into table DrNames
  323. IF NOT EXISTS
  324. (SELECT BinName FROM dbo.DrNames WHERE BinName = LOWER(@i_BinName))
  325. BEGIN
  326. INSERT dbo.DrNames(BinName) VALUES (LOWER(@i_BinName))
  327. END
  328. --
  329. SELECT @t_BinID=BinID FROM dbo.DrNames WHERE BinName = LOWER(@i_BinName)
  330. SELECT @t_CID=CID FROM dbo.DriverUsed WHERE CIDName = @i_CIDName
  331. -- Insert record into
  332. IF NOT EXISTS
  333. (SELECT CID FROM dbo.DrBins WHERE CID = @t_CID AND BinID = @t_BinID AND BinStamp = @i_BinStamp)
  334. BEGIN
  335. INSERT dbo.DrBins VALUES(@t_CID, @i_BinStamp, @t_BinID)
  336. END
  337. END
  338. GO
  339. SET QUOTED_IDENTIFIER OFF
  340. GO
  341. SET ANSI_NULLS ON
  342. GO
  343. SET QUOTED_IDENTIFIER ON
  344. GO
  345. SET ANSI_NULLS ON
  346. GO
  347. /****** Object: Stored Procedure dbo.sp_CategorizeBuckets Script Date: 12/19/2001 2:06:02 PM ******/
  348. /****** Object: Stored Procedure dbo.sp_CategorizeBuckets Script Date: 11/7/2001 3:53:58 AM ******/
  349. CREATE PROCEDURE sp_CategorizeBuckets
  350. @ip_Followup varchar(50),
  351. @ip_SortBy varchar(100)
  352. AS
  353. BEGIN
  354. -- sort by bucketid
  355. IF (@ip_SortBy = 'BucketId' OR @ip_SortBy = 'Bucket')
  356. BEGIN
  357. select BucketId,
  358. Instances,
  359. BugId AS Bug
  360. from BucketGroups
  361. WHERE Followup = @ip_Followup
  362. order by BucketId
  363. END
  364. -- sort by #Instances
  365. IF (@ip_SortBy = 'Instances')
  366. BEGIN
  367. select BucketId,
  368. Instances,
  369. BugId AS Bug
  370. from BucketGroups
  371. WHERE Followup = @ip_Followup
  372. order by Instances DESC
  373. END
  374. END
  375. GO
  376. SET QUOTED_IDENTIFIER OFF
  377. GO
  378. SET ANSI_NULLS ON
  379. GO
  380. SET QUOTED_IDENTIFIER ON
  381. GO
  382. SET ANSI_NULLS ON
  383. GO
  384. /****** Object: Stored Procedure dbo.sp_CheckCrashExists Script Date: 12/14/2001 5:00:04 PM ******/
  385. CREATE PROCEDURE sp_CheckCrashExists
  386. @i_IncidentId AS int
  387. AS
  388. BEGIN
  389. DECLARE @retval as int
  390. SET @retval = 0
  391. IF EXISTS (SELECT * FROM CrashInstances WHERE IncidentId = @i_IncidentId)
  392. BEGIN
  393. SET @retval = 1
  394. END
  395. SELECT @retval AS CrashExists
  396. END
  397. GO
  398. SET QUOTED_IDENTIFIER OFF
  399. GO
  400. SET ANSI_NULLS ON
  401. GO
  402. SET QUOTED_IDENTIFIER ON
  403. GO
  404. SET ANSI_NULLS ON
  405. GO
  406. /****** Object: Stored Procedure dbo.sp_DeleteSolution Script Date: 12/19/2001 2:06:05 PM ******/
  407. /****** Object: Stored Procedure dbo.sp_DeleteSolution Script Date: 11/7/2001 3:53:58 AM ******/
  408. CREATE PROCEDURE sp_DeleteSolution
  409. @BucketId varchar(100)
  410. AS
  411. BEGIN
  412. DECLARE @iBucket AS int
  413. DECLARE @DelId AS int
  414. SELECT @iBucket = iBucket FROM BucketToInt
  415. WHERE BucketId = @BucketId
  416. DELETE FROM RaidBugs
  417. WHERE iBucket = @iBucket
  418. SELECT @DelId = SolId FROM SolutionsMap
  419. WHERE iBucket = @iBucket
  420. DELETE FROM SolutionsMap
  421. WHERE iBucket = @iBucket
  422. IF NOT EXISTS (SELECT * FROM Solutions WHERE SolId = @DelId)
  423. BEGIN
  424. -- No one else used the same solution
  425. DELETE FROM Solutions
  426. WHERE @DelId = Solutions.SolId
  427. END
  428. SELECT @DelId = CommentId FROM CommentMap
  429. WHERE iBucket = @iBucket
  430. DELETE FROM CommentMap
  431. WHERE iBucket = @iBucket
  432. IF NOT EXISTS (SELECT * FROM Comments WHERE CommentId = @DelId)
  433. BEGIN
  434. -- No one else used the same solution
  435. DELETE FROM Coments
  436. WHERE @DelId = Comments.CommentId
  437. END
  438. END
  439. GO
  440. SET QUOTED_IDENTIFIER OFF
  441. GO
  442. SET ANSI_NULLS ON
  443. GO
  444. SET QUOTED_IDENTIFIER ON
  445. GO
  446. SET ANSI_NULLS ON
  447. GO
  448. /****** Object: Stored Procedure dbo.sp_EmptyBuckets Script Date: 12/19/2001 2:06:02 PM ******/
  449. /****** Object: Stored Procedure dbo.sp_EmptyBuckets Script Date: 11/7/2001 3:53:58 AM ******/
  450. CREATE PROCEDURE sp_EmptyBuckets
  451. @i_Remove int
  452. AS
  453. BEGIN
  454. IF @i_Remove = 1
  455. BEGIN
  456. DELETE FROM CrashBuckets
  457. WHERE BucketId NOT IN (SELECT DISTINCT(BucketId) FROM BucketMap)
  458. END
  459. SELECT Followup,
  460. BucketId AS Bucket
  461. FROM CrashBuckets
  462. WHERE BucketId NOT IN (SELECT DISTINCT(BucketId) FROM BucketMap)
  463. END
  464. GO
  465. SET QUOTED_IDENTIFIER OFF
  466. GO
  467. SET ANSI_NULLS ON
  468. GO
  469. SET QUOTED_IDENTIFIER ON
  470. GO
  471. SET ANSI_NULLS ON
  472. GO
  473. /****** Object: Stored Procedure dbo.sp_GetIntBucket Script Date: 12/19/2001 2:06:02 PM ******/
  474. CREATE PROCEDURE sp_GetIntBucket
  475. @i_BucketId1 as varchar(256),
  476. @i_BucketId2 as varchar(256)
  477. AS
  478. BEGIN
  479. DECLARE @id1 as int
  480. DECLARE @id2 as int
  481. SELECT @id1 = iBucket FROM BucketToInt
  482. WHERE BucketId = @i_BucketId1
  483. SELECT @id2 = iBucket FROM BucketToInt
  484. WHERE BucketId = @i_BucketId2
  485. SELECT @id1, @id2
  486. END
  487. GO
  488. SET QUOTED_IDENTIFIER OFF
  489. GO
  490. SET ANSI_NULLS ON
  491. GO
  492. SET QUOTED_IDENTIFIER ON
  493. GO
  494. SET ANSI_NULLS ON
  495. GO
  496. /****** Object: Stored Procedure dbo.sp_GetProblems Script Date: 12/19/2001 2:06:02 PM ******/
  497. /****** Object: Stored Procedure dbo.sp_GetProblems Script Date: 11/7/2001 3:53:58 AM ******/
  498. CREATE PROCEDURE sp_GetProblems
  499. @ip_BucketTypes int
  500. AS
  501. BEGIN
  502. -- BucketType = 0 : List all
  503. IF (@ip_BucketTypes = 0)
  504. BEGIN
  505. select * from bucketgroups
  506. order by Instances DESC
  507. END
  508. -- BucketType = 1 : List unresolved, unraided
  509. IF (@ip_BucketTypes = 1)
  510. BEGIN
  511. select * from bucketgroups
  512. --where ISNULL(bugid, 0) = 0 AND ISNULL(solvedate, '1/1/1900') = '1/1/1900'
  513. order by Instances DESC
  514. END
  515. -- BucketType = 2 : List raided buckets
  516. IF (@ip_BucketTypes = 2)
  517. BEGIN
  518. select * from bucketgroups
  519. where ISNULL(bugid, 0)<>0
  520. order by Instances DESC
  521. END
  522. -- BucketType = 3 : List solved buckets
  523. IF (@ip_BucketTypes = 3)
  524. BEGIN
  525. select * from bucketgroups
  526. -- where ISNULL(solvedate, '1/1/1900')<>'1/1/1900'
  527. order by Instances DESC
  528. END
  529. END
  530. GO
  531. SET QUOTED_IDENTIFIER OFF
  532. GO
  533. SET ANSI_NULLS ON
  534. GO
  535. SET QUOTED_IDENTIFIER ON
  536. GO
  537. SET ANSI_NULLS ON
  538. GO
  539. /****** Object: Stored Procedure dbo.sp_HexToInt Script Date: 12/19/2001 2:06:03 PM ******/
  540. /****** Object: Stored Procedure dbo.sp_HexToInt Script Date: 11/7/2001 3:53:58 AM ******/
  541. CREATE PROCEDURE sp_HexToInt
  542. @i_HexVal as varchar(10),
  543. @i_Len as int
  544. AS
  545. BEGIN
  546. DECLARE @Value as bigint
  547. DECLARE @Sub as int
  548. SET @Sub = 0
  549. SET @Value = 0
  550. while (@i_Len <> @Sub)
  551. BEGIN
  552. SET @Value = @Value * 16
  553. SET @Value = @Value + (ASCII(SUBSTRING(@i_HexVal, @Sub+1, 1)) - 48)
  554. SET @Sub = @Sub + 1
  555. END
  556. return @Value
  557. END
  558. GO
  559. SET QUOTED_IDENTIFIER OFF
  560. GO
  561. SET ANSI_NULLS ON
  562. GO
  563. SET QUOTED_IDENTIFIER ON
  564. GO
  565. SET ANSI_NULLS ON
  566. GO
  567. /****** Object: Stored Procedure dbo.sp_ListBucket Script Date: 12/19/2001 2:06:05 PM ******/
  568. /****** Object: Stored Procedure dbo.sp_ListBucket Script Date: 11/7/2001 3:53:58 AM ******/
  569. CREATE PROCEDURE sp_ListBucket
  570. @BucketId varchar (100)
  571. AS
  572. BEGIN
  573. SELECT BuildNo, Path, Source FROM CrashInsTances, BucketToInt, BucketToCrash
  574. WHERE CrashInstances.CrashId = BucketToCrash.CrashId AND
  575. BucketToInt.iBucket = BucketToCrash.iBucket AND
  576. BucketToInt.BucketId=@BucketId
  577. END
  578. GO
  579. SET QUOTED_IDENTIFIER OFF
  580. GO
  581. SET ANSI_NULLS ON
  582. GO
  583. SET QUOTED_IDENTIFIER ON
  584. GO
  585. SET ANSI_NULLS ON
  586. GO
  587. /****** Object: Stored Procedure dbo.sp_LookupBucket Script Date: 12/19/2001 2:06:05 PM ******/
  588. /****** Object: Stored Procedure dbo.sp_LookupBucket Script Date: 11/7/2001 3:53:58 AM ******/
  589. CREATE PROCEDURE sp_LookupBucket
  590. @s_BucketId varchar(100)
  591. AS
  592. BEGIN
  593. DECLARE @i_Bug int
  594. DECLARE @d_CommentDate DATETIME
  595. DECLARE @s_Comment varchar (1000)
  596. DECLARE @s_OSVersion varchar (30)
  597. DECLARE @s_CommentBy varchar (30)
  598. DECLARE @iBucket AS int
  599. DECLARE @FaultyDriver AS varchar (100)
  600. SELECT @iBucket = iBucket FROM BucketToInt
  601. WHERE BucketId = @s_BucketId
  602. -- Get the Raid bug
  603. SELECT @i_Bug = BugId FROM RaidBugs
  604. WHERE iBucket = @iBucket
  605. -- get the comment
  606. SELECT @s_Comment = Comment, @s_CommentBy = CommentBy, @d_CommentDate = EntryDate
  607. FROM Comments, CommentMap
  608. WHERE Comments.iBucket = @iBucket AND Comments.CommentId = CommentMap.CommentId
  609. -- get faulty driver
  610. SELECT @FaultyDriver = BinName FROM DrNames, DriverMap
  611. WHERE DriverMap.iBucket = @iBucket AND DriverMap.BinID = DrNames.BinID
  612. -- Output values
  613. SELECT @i_Bug AS Bug,
  614. @s_Comment AS Comment,
  615. @s_CommentBy AS CommentBy,
  616. @d_CommentDate AS CommentDate,
  617. @FaultyDriver AS FaultyDriver
  618. END
  619. GO
  620. SET QUOTED_IDENTIFIER OFF
  621. GO
  622. SET ANSI_NULLS ON
  623. GO
  624. SET QUOTED_IDENTIFIER ON
  625. GO
  626. SET ANSI_NULLS ON
  627. GO
  628. /****** Object: Stored Procedure dbo.sp_NewIssues Script Date: 12/19/2001 2:06:05 PM ******/
  629. /****** Object: Stored Procedure dbo.sp_NewIssues Script Date: 11/7/2001 3:53:58 AM ******/
  630. CREATE PROCEDURE sp_NewIssues
  631. @i_DaysOld int
  632. AS
  633. BEGIN
  634. IF @i_DaysOld = 0
  635. BEGIN
  636. SET @i_DaysOld = 1
  637. END
  638. -- Display new buckets
  639. SELECT BucketToInt.BucketId AS Bucket,
  640. MAX(EntryDate)AS NewestEntry
  641. FROM CrashInstances, BucketToInt, BucketToCrash
  642. WHERE DATEDIFF(day,EntryDate,GETDATE()) < @i_DaysOld AND
  643. BucketToCrash.CrashId = CrashInstances.CrashId AND
  644. BucketToCrash.iBucket = BucketToInt.iBucket
  645. GROUP BY BucketId
  646. END
  647. GO
  648. SET QUOTED_IDENTIFIER OFF
  649. GO
  650. SET ANSI_NULLS ON
  651. GO
  652. SET QUOTED_IDENTIFIER ON
  653. GO
  654. SET ANSI_NULLS ON
  655. GO
  656. /****** Object: Stored Procedure dbo.sp_NewIssuesThisWeek Script Date: 12/19/2001 2:06:06 PM ******/
  657. /****** Object: Stored Procedure dbo.sp_NewIssuesThisWeek Script Date: 11/7/2001 3:53:59 AM ******/
  658. CREATE PROCEDURE sp_NewIssuesThisWeek
  659. AS
  660. BEGIN
  661. -- Display new crashes added today
  662. /* SELECT BucketMap.BucketId AS Bucket,
  663. MIN(EntryDate)AS OldestEntry
  664. FROM CrashInstances, BucketMap
  665. WHERE DATEDIFF(day,EntryDate,GETDATE()) <= 7 AND BucketMap.CrashId = CrashInstances.CrashId
  666. GROUP BY BucketId
  667. */
  668. EXEC sp_NewIssues 7
  669. END
  670. GO
  671. SET QUOTED_IDENTIFIER OFF
  672. GO
  673. SET ANSI_NULLS ON
  674. GO
  675. SET QUOTED_IDENTIFIER ON
  676. GO
  677. SET ANSI_NULLS ON
  678. GO
  679. /****** Object: Stored Procedure dbo.sp_NewIssuesToday Script Date: 12/19/2001 2:06:06 PM ******/
  680. /****** Object: Stored Procedure dbo.sp_NewIssuesToday Script Date: 11/7/2001 3:53:59 AM ******/
  681. CREATE PROCEDURE sp_NewIssuesToday
  682. AS
  683. BEGIN
  684. -- Display new crashes added today
  685. /* SELECT Followup,
  686. BucketMap.BucketId AS Bucket,
  687. COUNT (BucketMap.CrashId) AS Instances
  688. FROM CrashInstances, BucketMap, CrashBuckets
  689. WHERE DATEPART(dd,EntryDate) = DATEPART(dd,GETDATE()) AND
  690. DATEPART(mm,EntryDate) = DATEPART(mm,GETDATE()) AND
  691. DATEPART(yy,EntryDate) = DATEPART(yy,GETDATE()) AND
  692. BucketMap.CrashId = CrashInstances.CrashId AND
  693. CrashBuckets.BucketId = BucketMap.BucketId
  694. GROUP BY BucketMap.BucketId, Followup
  695. ORDER BY Instances DESC
  696. */
  697. EXEC sp_NewIssues 1
  698. END
  699. GO
  700. SET QUOTED_IDENTIFIER OFF
  701. GO
  702. SET ANSI_NULLS ON
  703. GO
  704. SET QUOTED_IDENTIFIER OFF
  705. GO
  706. SET ANSI_NULLS ON
  707. GO
  708. /****** Object: Stored Procedure dbo.sp_PrivateCleanupCrash Script Date: 12/19/2001 2:06:05 PM ******/
  709. CREATE PROCEDURE sp_PrivateCleanupCrash
  710. @CrashId bigint
  711. AS
  712. BEGIN
  713. DELETE FROM BucketToCrash where Crashid = @CrashId
  714. IF EXISTS (SELECT * FROM OVERCLOCKED WHERE CrashId = @CrashId)
  715. BEGIN
  716. DELETE FROM OverClocked WHERE CrashId = @CrashId
  717. END
  718. delete from Crashinstances where Crashid = @CrashId
  719. END
  720. GO
  721. SET QUOTED_IDENTIFIER OFF
  722. GO
  723. SET ANSI_NULLS ON
  724. GO
  725. SET QUOTED_IDENTIFIER ON
  726. GO
  727. SET ANSI_NULLS ON
  728. GO
  729. /****** Object: Stored Procedure dbo.sp_RetriageCrash Script Date: 12/19/2001 2:06:05 PM ******/
  730. -- Change RetriageCrash
  731. CREATE PROCEDURE sp_RetriageCrash
  732. @ip_CrashId bigint,
  733. @ip_sBucketId varchar(100),
  734. @ip_gBucketId varchar(100),
  735. @ip_FollowUp varchar(50)
  736. AS
  737. BEGIN
  738. DECLARE @b_BucketExists int
  739. DECLARE @isBucket int
  740. DECLARE @igBucket int
  741. -- Check if crash exists
  742. IF NOT EXISTS
  743. (SELECT CrashId FROM CrashInstances WHERE CrashId = @ip_CrashId)
  744. BEGIN
  745. return 1
  746. END
  747. -- Add Buckt to followup mapping
  748. EXEC sp_AddBucketFollowup @ip_sBucketId, @ip_FollowUp
  749. SELECT @isBucket = iBucket FROM BucketToInt WHERE BucketId = @ip_sBucketId
  750. SELECT @igBucket = iBucket FROM BucketToInt WHERE BucketId = @ip_gBucketId
  751. -- Insert the Bucket into bucketmapping table
  752. IF EXISTS
  753. (SELECT iBucket FROM BucketToCrash WHERE CrashId = @ip_CrashId )
  754. BEGIN
  755. UPDATE BucketToCrash
  756. SET iBucket = @isBucket, gBucket = @igBucket
  757. FROM BucketToCrash
  758. WHERE CrashId = @ip_CrashId
  759. END
  760. ELSE
  761. BEGIN
  762. INSERT BucketToCrash VALUES (@ip_CrashId, @isBucket, @igBucket)
  763. END
  764. RETURN 0
  765. END
  766. GO
  767. SET QUOTED_IDENTIFIER OFF
  768. GO
  769. SET ANSI_NULLS ON
  770. GO
  771. SET QUOTED_IDENTIFIER ON
  772. GO
  773. SET ANSI_NULLS ON
  774. GO
  775. /****** Object: Stored Procedure dbo.sp_SearchDb Script Date: 12/19/2001 2:06:03 PM ******/
  776. /****** Object: Stored Procedure dbo.sp_SearchDb Script Date: 11/7/2001 3:53:58 AM ******/
  777. CREATE PROCEDURE sp_SearchDb
  778. @i_BucketStr varchar(100),
  779. @i_BucketStrType int, -- 0 : Equals, 1 : Contains
  780. @i_FollowUpStr varchar( 50 ),
  781. @i_FollowUpType int, -- 0 : Equals, 1 : Contains
  782. @i_BuildLower int,
  783. @i_BuildUpper int,
  784. @i_SolType int, -- 0 : All, 1 : Solved, 2 : Raided
  785. @i_GroupBuckets int -- 0 : List individual instances, 1 groupby buckets
  786. AS
  787. BEGIN
  788. SELECT * FROM BucketGroups
  789. WHERE (@i_FollowUpStr = '' OR Followup LIKE @i_FollowUpStr) AND
  790. (@i_BucketStr = '' OR BucketId LIKE @i_BucketStr)
  791. END
  792. /*
  793. OLD CODE
  794. IF (@i_BucketStr = '' AND @i_GroupBuckets <> 0)
  795. BEGIN
  796. SELECT cb.BucketId AS Bucket,
  797. fp.Followup AS Followup,
  798. COUNT (DISTINCT bm.CrashId) As Instances
  799. FROM CrashInstances AS ci, BucketToCrash AS bm, FollowupIds AS fp,
  800. BucketToInt AS cb, SolutionsMap AS si, RaidBugs AS rb
  801. WHERE (@i_FollowUpStr = '' OR fp.Followup LIKE @i_FollowUpStr) AND
  802. (@i_SolType = 0 OR
  803. ((@i_SolType = 1) AND cb.iBucket IN (SELECT iBucket FROM SolutionsMap)) OR
  804. ((@i_SolType = 2) AND cb.iBucket IN (SELECT iBucket FROM RaidBugs)) OR
  805. ((@i_SolType = 3) AND cb.iBucket IN
  806. (SELECT SolutionsMap.iBucket FROM SolutionsMap, RaidBugs
  807. WHERE RaidBugs.iBucket = SolutionsMap.iBucket))) AND
  808. ci.CrashId = bm.CrashId AND bm.iBucket = cb.iBucket AND
  809. fp.iBucket = cb.iBucket AND
  810. (ci.BuildNo BETWEEN @i_BuildLower AND @i_BuildUpper)
  811. GROUP BY cb.BucketId, fp.Followup
  812. ORDER BY instances DESC
  813. END
  814. ELSE IF (@i_GroupBuckets <> 0)
  815. BEGIN
  816. SELECT cb.BucketId AS Bucket,
  817. fp.Followup AS Followup,
  818. COUNT (DISTINCT bm.CrashId) As Instances
  819. FROM CrashInstances AS ci, BucketToCrash AS bm, Followups AS fp,
  820. BucketToInt AS cb, SolutionsMap AS si, RaidBugs AS rb
  821. WHERE (@i_FollowUpStr = '' OR fp.Followup LIKE @i_FollowUpStr) AND
  822. (@i_BucketStr = '' OR cb.BucketId LIKE @i_BucketStr) AND
  823. (@i_SolType = 0 OR
  824. ((@i_SolType = 1) AND cb.iBucket IN (SELECT iBucket FROM SolutionsMap)) OR
  825. ((@i_SolType = 2) AND cb.iBucket IN (SELECT iBucket FROM RaidBugs)) OR
  826. ((@i_SolType = 3) AND cb.iBucket IN
  827. (SELECT SolutionsMap.iBucket FROM SolutionsMap, RaidBugs
  828. WHERE RaidBugs.iBucket = SolutionsMap.iBucket))) AND
  829. ci.CrashId = bm.CrashId AND bm.iBucket = cb.iBucket AND
  830. fp.iBucket = cb.iBucket AND
  831. (ci.BuildNo BETWEEN @i_BuildLower AND @i_BuildUpper)
  832. GROUP BY cb.BucketId, fp.Followup
  833. ORDER BY instances DESC
  834. END
  835. ELSE
  836. BEGIN
  837. SELECT DISTINCT Path, cb.BucketId AS Bucket, Source
  838. FROM CrashInstances AS ci, BucketToCrash AS bm, Followups AS fp,
  839. BucketToInt AS cb, SolutionsMap AS si, RaidBugs AS rb
  840. WHERE ((@i_FollowUpStr = '' OR fp.Followup LIKE @i_FollowUpStr) AND
  841. (@i_BucketStr = '' OR cb.BucketId LIKE @i_BucketStr)) AND
  842. ( @i_SolType = 0 OR
  843. ((@i_SolType = 1) AND cb.iBucket IN (SELECT iBucket FROM SolutionsMap)) OR
  844. ((@i_SolType = 2) AND cb.iBucket IN (SELECT iBucket FROM RaidBugs)) OR
  845. ((@i_SolType = 3) AND cb.iBucket IN
  846. (SELECT SolutionsMap.iBucket FROM SolutionsMap, RaidBugs
  847. WHERE RaidBugs.iBucket = SolutionsMap.iBucket))) AND
  848. ci.CrashId = bm.CrashId AND bm.iBucket = cb.iBucket AND
  849. fp.iBucket = cb.iBucket AND
  850. (ci.BuildNo BETWEEN @i_BuildLower AND @i_BuildUpper)
  851. END
  852. */
  853. GO
  854. SET QUOTED_IDENTIFIER OFF
  855. GO
  856. SET ANSI_NULLS ON
  857. GO
  858. SET QUOTED_IDENTIFIER ON
  859. GO
  860. SET ANSI_NULLS ON
  861. GO
  862. /****** Object: Stored Procedure dbo.sp_SendMailForBucket Script Date: 12/19/2001 2:06:03 PM ******/
  863. /****** Object: Stored Procedure dbo.sp_SendMailForBucket Script Date: 11/7/2001 3:53:58 AM ******/
  864. CREATE PROCEDURE sp_SendMailForBucket
  865. @Bucket varchar(100)
  866. AS
  867. BEGIN
  868. DECLARE @MailTo varchar(50)
  869. DECLARE @Mesg varchar(1000)
  870. DECLARE @Subj varchar(50)
  871. SET @MailTo = ''
  872. SET @Subj = 'You have been assigned a new bucket'
  873. SET @Mesg = 'Click on http://dbgdumps/cr/crashinstances.asp?bucketid=' + @Bucket
  874. -- Send mail to person following up on given Bucket
  875. SELECT @MailTo = Followup FROM CrashBuckets
  876. WHERE BucketId = @Bucket
  877. IF @MailTo <> ''
  878. BEGIN
  879. EXEC master.dbo.xp_startmail
  880. EXEC master.dbo.xp_sendmail @recipients = @MailTo,
  881. @message = @Mesg,
  882. @subject = @Subj
  883. EXEC master.dbo.xp_stopmail
  884. END
  885. ELSE
  886. BEGIN
  887. SELECT 'Could not send mail - bucket not found'
  888. END
  889. END
  890. GO
  891. SET QUOTED_IDENTIFIER OFF
  892. GO
  893. SET ANSI_NULLS ON
  894. GO
  895. SET QUOTED_IDENTIFIER ON
  896. GO
  897. SET ANSI_NULLS ON
  898. GO
  899. /****** Object: Stored Procedure dbo.sp_SolvedIssuesThisWeek Script Date: 12/19/2001 2:06:03 PM ******/
  900. /****** Object: Stored Procedure dbo.sp_SolvedIssuesThisWeek Script Date: 11/7/2001 3:53:58 AM ******/
  901. CREATE PROCEDURE sp_SolvedIssuesThisWeek
  902. AS
  903. BEGIN
  904. -- Display crash buckets
  905. SELECT BucketId AS Bucket,
  906. SolveDate
  907. FROM SolvedIssues
  908. WHERE SolveDate >= DATEADD(day,-7,GETDATE())
  909. END
  910. GO
  911. SET QUOTED_IDENTIFIER OFF
  912. GO
  913. SET ANSI_NULLS ON
  914. GO
  915. SET QUOTED_IDENTIFIER ON
  916. GO
  917. SET ANSI_NULLS ON
  918. GO
  919. /****** Object: Stored Procedure dbo.sp_SolvedIssuesToday Script Date: 12/19/2001 2:06:03 PM ******/
  920. /****** Object: Stored Procedure dbo.sp_SolvedIssuesToday Script Date: 11/7/2001 3:53:58 AM ******/
  921. CREATE PROCEDURE sp_SolvedIssuesToday
  922. AS
  923. BEGIN
  924. -- Display crash buckets solved today
  925. SELECT BucketId AS Bucket,
  926. SolveDate
  927. FROM SolvedIssues
  928. WHERE DATEPART(dd,SolveDate) = DATEPART(dd,GETDATE()) AND
  929. DATEPART(mm,SolveDate) = DATEPART(mm,GETDATE()) AND
  930. DATEPART(yy,SolveDate) = DATEPART(yy,GETDATE())
  931. END
  932. GO
  933. SET QUOTED_IDENTIFIER OFF
  934. GO
  935. SET ANSI_NULLS ON
  936. GO
  937. SET QUOTED_IDENTIFIER OFF
  938. GO
  939. SET ANSI_NULLS OFF
  940. GO
  941. CREATE PROCEDURE DBGP_CompleteRetriageRequest (
  942. @RequestID int,
  943. @Tester char(10)
  944. ) AS
  945. UPDATE TriageQueue SET Tester = @Tester, CompleteDate = GetDate() where RequestID = @RequestID
  946. GO
  947. SET QUOTED_IDENTIFIER OFF
  948. GO
  949. SET ANSI_NULLS ON
  950. GO
  951. SET QUOTED_IDENTIFIER OFF
  952. GO
  953. SET ANSI_NULLS OFF
  954. GO
  955. CREATE PROCEDURE DBGP_CreateRetriageRequest(
  956. @BucketID varchar(100),
  957. @Alias char(10),
  958. @Reason varchar( 256 )
  959. ) AS
  960. INSERT INTO TriageQueue ( BucketID, Requestor, Reason ) VALUES ( @bucketID, @Alias, @Reason )
  961. GO
  962. SET QUOTED_IDENTIFIER OFF
  963. GO
  964. SET ANSI_NULLS ON
  965. GO
  966. SET QUOTED_IDENTIFIER OFF
  967. GO
  968. SET ANSI_NULLS OFF
  969. GO
  970. CREATE PROCEDURE DBGP_ApproveRetriageRequest (
  971. @RequestID int,
  972. @Approver char(10)
  973. ) AS
  974. UPDATE TriageQueue SET Approver = @Approver, ApprovalDate = GetDate() where RequestID = @RequestID
  975. GO
  976. SET QUOTED_IDENTIFIER OFF
  977. GO
  978. SET ANSI_NULLS ON
  979. GO
  980. SET QUOTED_IDENTIFIER OFF
  981. GO
  982. SET ANSI_NULLS OFF
  983. GO
  984. CREATE PROCEDURE DBGP_ClearPoolCorruption (
  985. @BucketID varchar(100)
  986. ) AS
  987. UPDATE BucketToInt SET PoolCorruption = NULL WHERE BucketID = @BucketID
  988. GO
  989. SET QUOTED_IDENTIFIER OFF
  990. GO
  991. SET ANSI_NULLS ON
  992. GO
  993. SET QUOTED_IDENTIFIER ON
  994. GO
  995. SET ANSI_NULLS OFF
  996. GO
  997. CREATE PROCEDURE DBGP_BuildDebugPortalTables AS
  998. --exec DBGP_UpdateCrashData
  999. PRINT '------ Dropping table DBGPortal_CrashData -----'
  1000. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGPortal_CrashData]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  1001. drop table [dbo].[DBGPortal_CrashData]
  1002. PRINT '------ Done dropping table -----'
  1003. PRINT '------ Dropping table Index CrashData1 -----'
  1004. IF EXISTS (SELECT name FROM sysindexes
  1005. WHERE name = 'DBGPortal_CrashData1')
  1006. DROP INDEX DBGPortal_CrashData.DBGPortal_CrashData1
  1007. PRINT '------ Done -----'
  1008. PRINT '------ Dropping table Index IX_DBGPortal_CrashData -----'
  1009. IF EXISTS( SELECT name FROM sysindexes
  1010. WHERE name = 'IX_DBGPortal_CrashData' )
  1011. DROP INDEX [DBGPortal_CrashData].IX_DBGPortal_CrashData
  1012. PRINT '------ Done -----'
  1013. PRINT '------ Dropping table Index CrashData_1 -----'
  1014. IF EXISTS( SELECT name FROM sysindexes
  1015. WHERE name = 'IX_DBGPortal_CrashData_1' )
  1016. DROP INDEX [DBGPortal_CrashData].IX_DBGPortal_CrashData_1
  1017. PRINT '------ Done -----'
  1018. PRINT '------ Dropping table Index CrashData_2 -----'
  1019. IF EXISTS( SELECT name FROM sysindexes
  1020. WHERE name = 'IX_DBGPortal_CrashData_2' )
  1021. DROP INDEX [DBGPortal_CrashData].IX_DBGPortal_CrashData_2
  1022. PRINT '------ Done -----'
  1023. PRINT '------ Dropping table Index CrashData_3 -----'
  1024. IF EXISTS( SELECT name FROM sysindexes
  1025. WHERE name = 'IX_DBGPortal_CrashData_3' )
  1026. DROP INDEX [DBGPortal_CrashData].IX_DBGPortal_CrashData_3
  1027. PRINT '------ Done -----'
  1028. PRINT '------ Dropping table Index CrashData_4 -----'
  1029. IF EXISTS( SELECT name FROM sysindexes
  1030. WHERE name = 'IX_DBGPortal_CrashData_4' )
  1031. DROP INDEX [DBGPortal_CrashData].IX_DBGPortal_CrashData_4
  1032. PRINT '------ Done -----'
  1033. PRINT '------ Dropping table Index CrashData_5 -----'
  1034. IF EXISTS( SELECT name FROM sysindexes
  1035. WHERE name = 'IX_DBGPortal_CrashData_5' )
  1036. DROP INDEX [DBGPortal_CrashData].IX_DBGPortal_CrashData_5
  1037. PRINT '------ Done -----'
  1038. PRINT '------ Creating Table DBGPotal_CrashData -----'
  1039. CREATE TABLE [dbo].[DBGPortal_CrashData] (
  1040. [DataIndex] [int] IDENTITY (1, 1) NOT NULL ,
  1041. [iBucket] [int] NULL ,
  1042. [BuildNo] [int] NULL ,
  1043. [IncidentID] [int] NULL ,
  1044. [EntryDate] [datetime] NULL ,
  1045. [TrackID] [nvarchar] (16) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  1046. [Email] [nvarchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  1047. [Path] [varchar] (256) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  1048. [Description] [nvarchar] (512) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  1049. [Comments] [nvarchar] (1024) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  1050. [Repro] [nvarchar] (1024) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
  1051. ) ON [PRIMARY]
  1052. PRINT '------ Done -----'
  1053. PRINT '------ Populating table CrashData -----'
  1054. INSERT INTO dbgportal_CrashData (Path, BuildNo, EntryDate, IncidentID, email, Description, Comments, Repro, iBucket, TrackID )
  1055. select Crash.Path, BuildNo, EntryDate, Inc.IncidentID, Email, Description, Comments, Repro, Crash.sBucket, trackID from CrashInstances as Crash
  1056. left join KaCustomer2.dbo.Incident as Inc on Crash.IncidentID=Inc.IncidentID
  1057. left join KaCustomer2.dbo.customer as Cust on Inc.HighId = Cust.HighID and Inc.LowId = Cust.LowID
  1058. PRINT '------ Done -----'
  1059. PRINT '------ Creating clustered index DBGPotal_Crashdata1 -----'
  1060. CREATE CLUSTERED INDEX [DBGPortal_CrashData1] ON [dbo].[DBGPortal_CrashData]([iBucket]) ON [PRIMARY]
  1061. PRINT '------ Done -----'
  1062. PRINT '------ Creating Index IX_DBG... -----'
  1063. CREATE INDEX [IX_DBGPortal_CrashData] ON [dbo].[DBGPortal_CrashData]([Path], [BuildNo], [EntryDate], [Email], [IncidentID], [TrackID]) ON [PRIMARY]
  1064. PRINT '------ Done -----'
  1065. PRINT '------ Creating Index IX_DBG. .1. -----'
  1066. CREATE INDEX [IX_DBGPortal_CrashData_1] ON [dbo].[DBGPortal_CrashData]([BuildNo]) ON [PRIMARY]
  1067. PRINT '------ Done -----'
  1068. PRINT '------ Creating Index IX_DBG. .2 -----'
  1069. CREATE INDEX [IX_DBGPortal_CrashData_2] ON [dbo].[DBGPortal_CrashData]([Email]) ON [PRIMARY]
  1070. PRINT '------ Done -----'
  1071. PRINT '------ Creating Index IX_DBG. .3. -----'
  1072. CREATE INDEX [IX_DBGPortal_CrashData_3] ON [dbo].[DBGPortal_CrashData]([Path]) ON [PRIMARY]
  1073. PRINT '------ Done -----'
  1074. PRINT '------ Creating Index IX_DBG. .4. -----'
  1075. CREATE INDEX [IX_DBGPortal_CrashData_4] ON [dbo].[DBGPortal_CrashData]([EntryDate]) ON [PRIMARY]
  1076. PRINT '------ Done -----'
  1077. PRINT '------ Creating Index IX_DBG. .5. -----'
  1078. CREATE INDEX [IX_DBGPortal_CrashData_5] ON [dbo].[DBGPortal_CrashData]([TrackID]) ON [PRIMARY]
  1079. PRINT '------ Done -----'
  1080. PRINT '------ Dropping table BucketDAta. -----'
  1081. /****** Object: Table [dbo].[DBGPortal_BucketData] Script Date: 1/23/2002 6:49:53 PM ******/
  1082. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGPortal_BucketData]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  1083. drop table [dbo].[DBGPortal_BucketData]
  1084. PRINT '------ Done -----'
  1085. PRINT '------ Delteing index IX_...BucketData. -----'
  1086. IF EXISTS (SELECT name FROM sysindexes
  1087. WHERE name = 'IX_DBGPortal_BucketData')
  1088. DROP INDEX DBGPortal_BucketData.IX_DBGPortal_BucketData
  1089. PRINT '------ Done -----'
  1090. PRINT '------ Createing BucketData Table -----'
  1091. /****** Object: Table [dbo].[DBGPortal_BucketData] Script Date: 1/23/2002 6:49:53 PM ******/
  1092. CREATE TABLE [dbo].[DBGPortal_BucketData] (
  1093. [BucketIndex] [int] NULL ,
  1094. [iBucket] [int] NOT NULL ,
  1095. [CrashCount] [int] NOT NULL ,
  1096. [BugID] [int] NULL ,
  1097. [SolutionID] [int] NULL,
  1098. [Platform][int] NULL,
  1099. [FollowUp] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
  1100. [BucketID] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
  1101. ) ON [PRIMARY]
  1102. PRINT '------ Done -----'
  1103. PRINT '------ Creating Tmp table-----'
  1104. declare @tmpTable Table(
  1105. AnIndex int IDENTITY(1,1) NOT NULL,
  1106. -- [BucketIndex] [int],
  1107. iBucket int,
  1108. CrashCount int ,
  1109. BugID int ,
  1110. SolutionID int,
  1111. Platform int,
  1112. FollowUp varchar(50),
  1113. BucketID varchar(100)
  1114. )
  1115. PRINT '------ Done -----'
  1116. PRINT '------ Populating temp table with bucketdata. -----'
  1117. --INSERT INTO @TmpTable ( iBucket, BucketID, FollowUP, CrashCount, BugID, SolutionID, Platform)
  1118. INSERT INTO @TmpTable ( iBucket, CrashCount, BugID, SolutionID, Platform, FollowUP, BucketID )
  1119. SELECT One.iBucket, CrashCount, BugID, SolutionID, Platform, FollowUP, BTI.BucketID FROM (
  1120. SELECT TOP 100 PERCENT COUNT(IBucket) as CrashCount, iBucket FROM DbGPortal_CrashData
  1121. GROUP BY iBucket
  1122. ORDER BY CrashCount DESC
  1123. ) as One
  1124. INNER JOIN BucketToint as BTI on One.iBucket = BTI.iBucket
  1125. LEFT JOIN FollowUpIds as F ON BTI.iFollowUP = F.iFollowUp
  1126. LEFT JOIN Solutions.DBO.SolvedBuckets ON BucketID = strBucket
  1127. LEFT JOIN RaidBugs as R ON BTI.iBucket = R.iBucket
  1128. WHERE BugID is NULL and SolutioNID is NULL
  1129. ORDER BY CrashCount DESC
  1130. PRINT '------ Done -----'
  1131. PRINT '------ Populating DBGPortal_BucketData table. -----'
  1132. INSERT INTO DBGPOrtal_BucketData ( BucketIndex, iBucket, CrashCount, BugID, SolutionID, Platform , FollowUP, BucketID )
  1133. SELECT AnIndex, iBucket, CrashCount, BugID, SolutionID, Platform, FollowUP, BucketID FROM @TmpTable ORDER BY CrashCount DESC
  1134. PRINT '------ Done -----'
  1135. PRINT '------ Clearing temp talbe -----'
  1136. DELETE FROM @TmpTable
  1137. PRINT '------ Done -----'
  1138. PRINT '------ Populating temp table iwth solved raided buckets -----'
  1139. INSERT INTO @TmpTable ( iBucket, CrashCount, BugID, SolutionID, Platform, FollowUp, BucketID )
  1140. SELECT One.iBucket, CrashCount, BugID, SolutionID, Platform, FollowUP, BTI.BucketID FROM (
  1141. SELECT TOP 100 PERCENT COUNT(IBucket) as CrashCount, iBucket FROM DbGPortal_CrashData
  1142. GROUP BY iBucket
  1143. ORDER BY CrashCount DESC
  1144. ) as One
  1145. INNER JOIN BucketToint as BTI on One.iBucket = BTI.iBucket
  1146. LEFT JOIN FollowUpIds as F ON BTI.iFollowUP = F.iFollowUp
  1147. LEFT JOIN Solutions.DBO.SolvedBuckets ON BucketID = strBucket
  1148. LEFT JOIN RaidBugs as R ON BTI.iBucket = R.iBucket
  1149. WHERE BugID is not NULL or SolutioNID is NOT NULL
  1150. ORDER BY CrashCount DESC
  1151. PRINT '------ Done -----'
  1152. PRINT '------ Populating BucketData table with solved, raidied data. -----'
  1153. INSERT INTO DBGPOrtal_BucketData ( BucketIndex, iBucket, CrashCount, BugID, SolutionID, Platform, FollowUP, BucketID )
  1154. SELECT AnIndex, iBucket, CrashCount, BugID, SolutionID, Platform, FollowUp, BucketID FROM @TmpTable ORDER BY CrashCount DESC
  1155. PRINT '------ Done -----'
  1156. PRINT '------ Creating clusterd index. -----'
  1157. CREATE CLUSTERED INDEX [IX_DBGPortal_BucketData] ON [dbo].[DBGPortal_BucketData]([CrashCount] DESC ) ON [PRIMARY]
  1158. PRINT '------ Done -----'
  1159. GO
  1160. SET QUOTED_IDENTIFIER OFF
  1161. GO
  1162. SET ANSI_NULLS ON
  1163. GO
  1164. SET QUOTED_IDENTIFIER OFF
  1165. GO
  1166. SET ANSI_NULLS OFF
  1167. GO
  1168. CREATE PROCEDURE DBGP_SetPoolCorruption(
  1169. @BucketID varchar(100)
  1170. ) AS
  1171. UPDATE BucketToInt SET PoolCorruption = 1 WHERE BucketID = @BucketID
  1172. GO
  1173. SET QUOTED_IDENTIFIER OFF
  1174. GO
  1175. SET ANSI_NULLS ON
  1176. GO