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.

3112 lines
88 KiB

  1. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_BuildDebugPortalTables]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  2. drop procedure [dbo].[DBGP_BuildDebugPortalTables]
  3. GO
  4. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_GetAllBucketDataByRange]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  5. drop procedure [dbo].[DBGP_GetAllBucketDataByRange]
  6. GO
  7. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_GetAllSolutionRequestsBySolutionID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  8. drop procedure [dbo].[DBGP_GetAllSolutionRequestsBySolutionID]
  9. GO
  10. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_GetBucketCrashData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  11. drop procedure [dbo].[DBGP_GetBucketCrashData]
  12. GO
  13. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_GetBucketCrashes]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  14. drop procedure [dbo].[DBGP_GetBucketCrashes]
  15. GO
  16. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_GetBucketData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  17. drop procedure [dbo].[DBGP_GetBucketData]
  18. GO
  19. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_GetBucketIDByiBucket]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  20. drop procedure [dbo].[DBGP_GetBucketIDByiBucket]
  21. GO
  22. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_GetBucketStats]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  23. drop procedure [dbo].[DBGP_GetBucketStats]
  24. GO
  25. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_GetBucketStatus]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  26. drop procedure [dbo].[DBGP_GetBucketStatus]
  27. GO
  28. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_GetBuckets]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  29. drop procedure [dbo].[DBGP_GetBuckets]
  30. GO
  31. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_GetBucketsByAlias]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  32. drop procedure [dbo].[DBGP_GetBucketsByAlias]
  33. GO
  34. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_GetBucketsByElapsedTime]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  35. drop procedure [dbo].[DBGP_GetBucketsByElapsedTime]
  36. GO
  37. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_GetBucketsBySpecificBuildNumber]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  38. drop procedure [dbo].[DBGP_GetBucketsBySpecificBuildNumber]
  39. GO
  40. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_GetCommentActions]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  41. drop procedure [dbo].[DBGP_GetCommentActions]
  42. GO
  43. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_GetCommentsByBucketID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  44. drop procedure [dbo].[DBGP_GetCommentsByBucketID]
  45. GO
  46. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_GetCrashInfoPerFile]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  47. drop procedure [dbo].[DBGP_GetCrashInfoPerFile]
  48. GO
  49. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_GetCustomerInfoByBucketID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  50. drop procedure [dbo].[DBGP_GetCustomerInfoByBucketID]
  51. GO
  52. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_GetCustomerInfoByIncident]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  53. drop procedure [dbo].[DBGP_GetCustomerInfoByIncident]
  54. GO
  55. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_GetDeliveryTypes]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  56. drop procedure [dbo].[DBGP_GetDeliveryTypes]
  57. GO
  58. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_GetFollowUpAliases]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  59. drop procedure [dbo].[DBGP_GetFollowUpAliases]
  60. GO
  61. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_GetFollowUpBucketCounts]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  62. drop procedure [dbo].[DBGP_GetFollowUpBucketCounts]
  63. GO
  64. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_GetPendingSolutionRequestByBucketID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  65. drop procedure [dbo].[DBGP_GetPendingSolutionRequestByBucketID]
  66. GO
  67. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_GetPendingSolutionRequests]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  68. drop procedure [dbo].[DBGP_GetPendingSolutionRequests]
  69. GO
  70. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_GetSolutionTypes]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  71. drop procedure [dbo].[DBGP_GetSolutionTypes]
  72. GO
  73. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_GetSolvedBucketsBySpecificBuildNumber]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  74. drop procedure [dbo].[DBGP_GetSolvedBucketsBySpecificBuildNumber]
  75. GO
  76. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_GetStaticDataRowCount]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  77. drop procedure [dbo].[DBGP_GetStaticDataRowCount]
  78. GO
  79. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_GetTopUnsolvedBuckets]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  80. drop procedure [dbo].[DBGP_GetTopUnsolvedBuckets]
  81. GO
  82. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_GetUnsolvedBucketsBySpecificBuildNumber]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  83. drop procedure [dbo].[DBGP_GetUnsolvedBucketsBySpecificBuildNumber]
  84. GO
  85. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_GetibucketByBucketID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  86. drop procedure [dbo].[DBGP_GetibucketByBucketID]
  87. GO
  88. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_SetBucketBugNumber]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  89. drop procedure [dbo].[DBGP_SetBucketBugNumber]
  90. GO
  91. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_SetComment]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  92. drop procedure [dbo].[DBGP_SetComment]
  93. GO
  94. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_UpdateCrashData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  95. drop procedure [dbo].[DBGP_UpdateCrashData]
  96. GO
  97. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_UpdateStaticDataBugID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  98. drop procedure [dbo].[DBGP_UpdateStaticDataBugID]
  99. GO
  100. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGP_UpdateStaticDataSolutionID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  101. drop procedure [dbo].[DBGP_UpdateStaticDataSolutionID]
  102. GO
  103. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_CountTotalBuckets]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  104. drop procedure [dbo].[SEP_CountTotalBuckets]
  105. GO
  106. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetBucketBugID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  107. drop procedure [dbo].[SEP_GetBucketBugID]
  108. GO
  109. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetBucketList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  110. drop procedure [dbo].[SEP_GetBucketList]
  111. GO
  112. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetBucketListRange]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  113. drop procedure [dbo].[SEP_GetBucketListRange]
  114. GO
  115. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetBucketNameByiBucket]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  116. drop procedure [dbo].[SEP_GetBucketNameByiBucket]
  117. GO
  118. SET QUOTED_IDENTIFIER ON
  119. GO
  120. SET ANSI_NULLS OFF
  121. GO
  122. CREATE PROCEDURE DBGP_BuildDebugPortalTables AS
  123. --exec DBGP_UpdateCrashData
  124. PRINT '------ Dropping table DBGPortal_CrashData -----'
  125. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGPortal_CrashData]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  126. drop table [dbo].[DBGPortal_CrashData]
  127. PRINT '------ Done dropping table -----'
  128. PRINT '------ Dropping table Index CrashData1 -----'
  129. IF EXISTS (SELECT name FROM sysindexes
  130. WHERE name = 'DBGPortal_CrashData1')
  131. DROP INDEX DBGPortal_CrashData.DBGPortal_CrashData1
  132. PRINT '------ Done -----'
  133. PRINT '------ Dropping table Index IX_DBGPortal_CrashData -----'
  134. IF EXISTS( SELECT name FROM sysindexes
  135. WHERE name = 'IX_DBGPortal_CrashData' )
  136. DROP INDEX [DBGPortal_CrashData].IX_DBGPortal_CrashData
  137. PRINT '------ Done -----'
  138. PRINT '------ Dropping table Index CrashData_1 -----'
  139. IF EXISTS( SELECT name FROM sysindexes
  140. WHERE name = 'IX_DBGPortal_CrashData_1' )
  141. DROP INDEX [DBGPortal_CrashData].IX_DBGPortal_CrashData_1
  142. PRINT '------ Done -----'
  143. PRINT '------ Dropping table Index CrashData_2 -----'
  144. IF EXISTS( SELECT name FROM sysindexes
  145. WHERE name = 'IX_DBGPortal_CrashData_2' )
  146. DROP INDEX [DBGPortal_CrashData].IX_DBGPortal_CrashData_2
  147. PRINT '------ Done -----'
  148. PRINT '------ Dropping table Index CrashData_3 -----'
  149. IF EXISTS( SELECT name FROM sysindexes
  150. WHERE name = 'IX_DBGPortal_CrashData_3' )
  151. DROP INDEX [DBGPortal_CrashData].IX_DBGPortal_CrashData_3
  152. PRINT '------ Done -----'
  153. PRINT '------ Dropping table Index CrashData_4 -----'
  154. IF EXISTS( SELECT name FROM sysindexes
  155. WHERE name = 'IX_DBGPortal_CrashData_4' )
  156. DROP INDEX [DBGPortal_CrashData].IX_DBGPortal_CrashData_4
  157. PRINT '------ Done -----'
  158. PRINT '------ Dropping table Index CrashData_5 -----'
  159. IF EXISTS( SELECT name FROM sysindexes
  160. WHERE name = 'IX_DBGPortal_CrashData_5' )
  161. DROP INDEX [DBGPortal_CrashData].IX_DBGPortal_CrashData_5
  162. PRINT '------ Done -----'
  163. PRINT '------ Creating Table DBGPotal_CrashData -----'
  164. CREATE TABLE [dbo].[DBGPortal_CrashData] (
  165. [DataIndex] [int] IDENTITY (1, 1) NOT NULL ,
  166. [Path] [varchar] (256) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  167. [BuildNo] [int] NULL ,
  168. [EntryDate] [datetime] NULL ,
  169. [IncidentID] [int] NULL ,
  170. [Email] [nvarchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  171. [Description] [nvarchar] (512) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  172. [Comments] [nvarchar] (1024) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  173. [Repro] [nvarchar] (1024) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  174. [TrackID] [nvarchar] (16) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  175. [iBucket] [int] NULL
  176. ) ON [PRIMARY]
  177. PRINT '------ Done -----'
  178. PRINT '------ Populating table CrashData -----'
  179. INSERT INTO dbgportal_CrashData (Path, BuildNo, EntryDate, IncidentID, email, Description, Comments, Repro, iBucket, TrackID )
  180. select Crash.Path, BuildNo, EntryDate, Inc.IncidentID, Email, Description, Comments, Repro, Crash.sBucket, trackID from CrashInstances as Crash
  181. left join KaCustomer2.dbo.Incident as Inc on Crash.IncidentID=Inc.IncidentID
  182. left join KaCustomer2.dbo.customer as Cust on Inc.HighId = Cust.HighID and Inc.LowId = Cust.LowID
  183. PRINT '------ Done -----'
  184. PRINT '------ Creating clustered index DBGPotal_Crashdata1 -----'
  185. CREATE CLUSTERED INDEX [DBGPortal_CrashData1] ON [dbo].[DBGPortal_CrashData]([iBucket]) ON [PRIMARY]
  186. PRINT '------ Done -----'
  187. PRINT '------ Creating Index IX_DBG... -----'
  188. CREATE INDEX [IX_DBGPortal_CrashData] ON [dbo].[DBGPortal_CrashData]([Path], [BuildNo], [EntryDate], [Email], [IncidentID], [TrackID]) ON [PRIMARY]
  189. PRINT '------ Done -----'
  190. PRINT '------ Creating Index IX_DBG. .1. -----'
  191. CREATE INDEX [IX_DBGPortal_CrashData_1] ON [dbo].[DBGPortal_CrashData]([BuildNo]) ON [PRIMARY]
  192. PRINT '------ Done -----'
  193. PRINT '------ Creating Index IX_DBG. .2 -----'
  194. CREATE INDEX [IX_DBGPortal_CrashData_2] ON [dbo].[DBGPortal_CrashData]([Email]) ON [PRIMARY]
  195. PRINT '------ Done -----'
  196. PRINT '------ Creating Index IX_DBG. .3. -----'
  197. CREATE INDEX [IX_DBGPortal_CrashData_3] ON [dbo].[DBGPortal_CrashData]([Path]) ON [PRIMARY]
  198. PRINT '------ Done -----'
  199. PRINT '------ Creating Index IX_DBG. .4. -----'
  200. CREATE INDEX [IX_DBGPortal_CrashData_4] ON [dbo].[DBGPortal_CrashData]([EntryDate]) ON [PRIMARY]
  201. PRINT '------ Done -----'
  202. PRINT '------ Creating Index IX_DBG. .5. -----'
  203. CREATE INDEX [IX_DBGPortal_CrashData_5] ON [dbo].[DBGPortal_CrashData]([TrackID]) ON [PRIMARY]
  204. PRINT '------ Done -----'
  205. PRINT '------ Dropping table BucketDAta. -----'
  206. /****** Object: Table [dbo].[DBGPortal_BucketData] Script Date: 1/23/2002 6:49:53 PM ******/
  207. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGPortal_BucketData]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  208. drop table [dbo].[DBGPortal_BucketData]
  209. PRINT '------ Done -----'
  210. PRINT '------ Delteing index IX_...BucketData. -----'
  211. IF EXISTS (SELECT name FROM sysindexes
  212. WHERE name = 'IX_DBGPortal_BucketData')
  213. DROP INDEX DBGPortal_BucketData.IX_DBGPortal_BucketData
  214. PRINT '------ Done -----'
  215. PRINT '------ Createing BucketData Table -----'
  216. /****** Object: Table [dbo].[DBGPortal_BucketData] Script Date: 1/23/2002 6:49:53 PM ******/
  217. CREATE TABLE [dbo].[DBGPortal_BucketData] (
  218. [BucketIndex] [int] NULL ,
  219. [iBucket] [int] NOT NULL ,
  220. [BucketID] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
  221. [FollowUp] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  222. [CrashCount] [int] NOT NULL ,
  223. [BugID] [int] NULL ,
  224. [SolutionID] [int] NULL
  225. ) ON [PRIMARY]
  226. PRINT '------ Done -----'
  227. PRINT '------ Creating Tmp table-----'
  228. declare @tmpTable Table(
  229. AnIndex int IDENTITY(1,1) NOT NULL,
  230. -- [BucketIndex] [int],
  231. iBucket int,
  232. BucketID varchar(100),
  233. FollowUp varchar(50),
  234. CrashCount int ,
  235. BugID int ,
  236. SolutionID int
  237. )
  238. PRINT '------ Done -----'
  239. PRINT '------ Populating temp table with bucketdata. -----'
  240. --INSERT INTO DBGPortaL_BucketData ( iBucket, BucketID, FollowUP, CrashCount, BugID, SolutionID)
  241. INSERT INTO @TmpTable ( iBucket, BucketID, FollowUP, CrashCount, BugID, SolutionID)
  242. SELECT One.iBucket, BTI.BucketID, FollowUP, CrashCount, BugID, SolutionID FROM (
  243. SELECT TOP 100 PERCENT COUNT(IBucket) as CrashCount, iBucket FROM DbGPortal_CrashData
  244. GROUP BY iBucket
  245. ORDER BY CrashCount DESC
  246. ) as One
  247. INNER JOIN BucketToint as BTI on One.iBucket = BTI.iBucket
  248. LEFT JOIN FollowUpIds as F ON BTI.iFollowUP = F.iFollowUp
  249. LEFT JOIN Solutions.DBO.SolvedBuckets ON BucketID = strBucket
  250. LEFT JOIN RaidBugs as R ON BTI.iBucket = R.iBucket
  251. WHERE BugID is NULL and SolutioNID is NULL
  252. ORDER BY CrashCount DESC
  253. PRINT '------ Done -----'
  254. PRINT '------ Populating DBGPortal_BucketData table. -----'
  255. INSERT INTO DBGPOrtal_BucketData ( BucketIndex, iBucket, BucketID, FollowUP, CrashCount, BugID, SolutionID)
  256. SELECT AnIndex, iBucket, BucketID, FollowUP, CrashCount, BugID, SolutionID FROM @TmpTable ORDER BY CrashCount DESC
  257. PRINT '------ Done -----'
  258. PRINT '------ Clearing temp talbe -----'
  259. DELETE FROM @TmpTable
  260. PRINT '------ Done -----'
  261. PRINT '------ Populating temp table iwth solved raided buckets -----'
  262. INSERT INTO @TmpTable ( iBucket, BucketID, FollowUP, CrashCount, BugID, SolutionID)
  263. SELECT One.iBucket, BTI.BucketID, FollowUP, CrashCount, BugID, SolutionID FROM (
  264. SELECT TOP 100 PERCENT COUNT(IBucket) as CrashCount, iBucket FROM DbGPortal_CrashData
  265. GROUP BY iBucket
  266. ORDER BY CrashCount DESC
  267. ) as One
  268. INNER JOIN BucketToint as BTI on One.iBucket = BTI.iBucket
  269. LEFT JOIN FollowUpIds as F ON BTI.iFollowUP = F.iFollowUp
  270. LEFT JOIN Solutions.DBO.SolvedBuckets ON BucketID = strBucket
  271. LEFT JOIN RaidBugs as R ON BTI.iBucket = R.iBucket
  272. WHERE BugID is not NULL or SolutioNID is NOT NULL
  273. ORDER BY CrashCount DESC
  274. PRINT '------ Done -----'
  275. PRINT '------ Populating BucketData table with solved, raidied data. -----'
  276. INSERT INTO DBGPOrtal_BucketData ( BucketIndex, iBucket, BucketID, FollowUP, CrashCount, BugID, SolutionID)
  277. SELECT AnIndex, iBucket, BucketID, FollowUP, CrashCount, BugID, SolutionID FROM @TmpTable ORDER BY CrashCount DESC
  278. PRINT '------ Done -----'
  279. PRINT '------ Creating clusterd index. -----'
  280. CREATE CLUSTERED INDEX [IX_DBGPortal_BucketData] ON [dbo].[DBGPortal_BucketData]([CrashCount] DESC ) ON [PRIMARY]
  281. PRINT '------ Done -----'
  282. GO
  283. SET QUOTED_IDENTIFIER OFF
  284. GO
  285. SET ANSI_NULLS ON
  286. GO
  287. SET QUOTED_IDENTIFIER OFF
  288. GO
  289. SET ANSI_NULLS OFF
  290. GO
  291. CREATE PROCEDURE DBGP_GetAllBucketDataByRange(
  292. @Page int,
  293. @PageSize int = 25
  294. ) AS
  295. --SELECT BTI.iBucket, BTI.BucketID, FollowUp, Count(sBucket) as [CrashCount], BugID, SolutionID FROM BucketToInt as BTI
  296. --LEFT JOIN FollowUpIds as F ON BTI.iFollowUP = F.iFollowUp
  297. --INNER JOIN CrashInstances as C on BTI.iBucket = sBucket
  298. --LEFT JOIN Solutions.DBO.SolvedBuckets ON BTI.BucketID = strBucket
  299. --LEFT JOIN RaidBugs as R ON BTI.iBucket = R.iBucket
  300. --where BTI.iBucket> @Start and BTI.iBucket <= @Start + @Range
  301. --GROUP BY BTI.iBucket, BTI.bucketID, FollowUp, BugID, SolutionID
  302. --order by BTI.iBucket
  303. declare @tmpTable Table(
  304. AnIndex int IDENTITY(1,1) NOT NULL,
  305. [BucketIndex] [int] NULL ,
  306. [iBucket] [int] NOT NULL ,
  307. [BucketID] [varchar] (100) NOT NULL ,
  308. [FollowUp] [varchar] (50) NULL ,
  309. [CrashCount] [int] NOT NULL ,
  310. [BugID] [int] NULL ,
  311. [SolutionID] [int] NULL
  312. )
  313. --INSERT INTO @TmpTable (Path, BuildNo, EntryDate, IncidentID, email, Description, Comments, Repro )
  314. --Select Crash.Path, BuildNo, EntryDate, Inc.IncidentID, Email, Description, Comments, Repro from
  315. -- KaCustomer2.dbo.Incident as Inc
  316. --left join KaCustomer2.dbo.customer as Cust on Inc.HighId = Cust.HighID and Inc.LowId = Cust.LowID
  317. --left join CrashDB2.dbo.CrashInstances as crash on crash.IncidentID = Inc.IncidentID
  318. -- where Inc.sBucket=@iBucket and Crash.Path is not null order by EntryDate desc
  319. BEGIN
  320. INSERT INTO @tmpTable (iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  321. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID from DBGPortal_BucketData
  322. order by CrashCount DESC
  323. END
  324. --select Path, BuildNo, EntryDate, IncidentID, Email, Description, Comments, Repro from @TmpTable where Anindex>=(@Page-1)*@PageSize and AnIndex < ((@Page-1) *@PageSize) + @PageSize
  325. select iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID from @TmpTable where Anindex>=(@Page-1)*@PageSize and AnIndex < ((@Page-1) *@PageSize) + @PageSize
  326. GO
  327. SET QUOTED_IDENTIFIER OFF
  328. GO
  329. SET ANSI_NULLS ON
  330. GO
  331. SET QUOTED_IDENTIFIER ON
  332. GO
  333. SET ANSI_NULLS OFF
  334. GO
  335. CREATE PROCEDURE DBGP_GetAllSolutionRequestsBySolutionID(
  336. @SolutionID int
  337. ) AS
  338. SELECT strBucket, Comment FROM Solutions.dbo.SolvedBuckets
  339. INNER JOIN CrashDB2.DBO.Comments on BucketID = strBucket
  340. WHERE SolutionID = @SolutionID and ( ActionID = 10 or ActionID=8 )
  341. GO
  342. SET QUOTED_IDENTIFIER OFF
  343. GO
  344. SET ANSI_NULLS ON
  345. GO
  346. SET QUOTED_IDENTIFIER ON
  347. GO
  348. SET ANSI_NULLS ON
  349. GO
  350. CREATE PROCEDURE DBGP_GetBucketCrashData (
  351. @iBucket int,
  352. @Page int = 1,
  353. @PageSize int = 25
  354. ) AS
  355. --SELECT top 10 path, BuildNo, EntryDate, IncidentID FROM CrashInstances
  356. --where sBucket = @iBucket
  357. --ORDER BY EntryDate DESC
  358. declare @tmpTable Table(
  359. AnIndex int IDENTITY(1,1) NOT NULL,
  360. Path varchar(256),
  361. buildNo int,
  362. EntryDate datetime,
  363. IncidentID int
  364. -- email nvarchar(128),
  365. -- Description nvarchar(512),
  366. -- comments nvarchar(1024),
  367. -- repro nvarchar(1024)
  368. )
  369. INSERT INTO @TmpTable (Path, BuildNo, EntryDate, IncidentID )
  370. SELECT path, BuildNo, EntryDate, IncidentID FROM CrashInstances
  371. where sBucket = @iBucket
  372. ORDER BY EntryDate DESC
  373. select * from @TmpTable where Anindex>=(@Page-1)*@PageSize and AnIndex < ((@Page-1) *@PageSize) + @PageSize
  374. --SELECT path, BuildNo, EntryDate, IncidentID FROM CrashInstances
  375. --where sBucket = @iBucket
  376. --ORDER BY EntryDate DESC
  377. --SELECT top 10 path, BuildNo, EntryDate, IncidentID FROM CrashInstances
  378. --where sBucket = @iBucket
  379. --ORDER BY EntryDate DESC
  380. --Select top 25 Crash.Path, BuildNo, EntryDate, Inc.IncidentID, Email, Description, Comments, Repro from
  381. -- KaCustomer2.dbo.Incident as Inc
  382. --left join KaCustomer2.dbo.customer as Cust on Inc.HighId = Cust.HighID and Inc.LowId = Cust.LowID
  383. --left join CrashDB2.dbo.CrashInstances as crash on crash.IncidentID = Inc.IncidentID
  384. -- where Inc.sBucket=@iBucket and Crash.Path is not null order by EntryDate desc
  385. GO
  386. SET QUOTED_IDENTIFIER OFF
  387. GO
  388. SET ANSI_NULLS ON
  389. GO
  390. SET QUOTED_IDENTIFIER OFF
  391. GO
  392. SET ANSI_NULLS OFF
  393. GO
  394. CREATE PROCEDURE DBGP_GetBucketCrashes(
  395. @iBucket int,
  396. @Page int,
  397. @PageSize int,
  398. @CustomerInfo int = 0,
  399. @OrderBy varchar(25) = 'email'
  400. ) AS
  401. declare @tmpTable Table(
  402. AnIndex int IDENTITY(1,1) NOT NULL,
  403. Path varchar(256),
  404. buildNo int,
  405. EntryDate datetime,
  406. IncidentID int,
  407. email nvarchar(128),
  408. Description nvarchar(512),
  409. comments nvarchar(1024),
  410. repro nvarchar(1024),
  411. TrackID nvarchar(16)
  412. )
  413. --INSERT INTO @TmpTable (Path, BuildNo, EntryDate, IncidentID, email, Description, Comments, Repro )
  414. --Select Crash.Path, BuildNo, EntryDate, Inc.IncidentID, Email, Description, Comments, Repro from
  415. -- KaCustomer2.dbo.Incident as Inc
  416. --left join KaCustomer2.dbo.customer as Cust on Inc.HighId = Cust.HighID and Inc.LowId = Cust.LowID
  417. --left join CrashDB2.dbo.CrashInstances as crash on crash.IncidentID = Inc.IncidentID
  418. -- where Inc.sBucket=@iBucket and Crash.Path is not null order by EntryDate desc
  419. IF ( @CustomerInfo = 1 )
  420. BEGIN
  421. INSERT INTO @tmpTable (Path, BuildNo, EntryDate, IncidentID, email, Description, Comments, Repro, TrackID )
  422. SELECT Path, BuildNo, EntryDate, IncidentID, email, Description, Comments, Repro, TrackID from DBGPortal_CrashData
  423. where iBucket=@iBucket order by Email desc
  424. END
  425. ELSE
  426. BEGIN
  427. INSERT INTO @tmpTable (Path, BuildNo, EntryDate, IncidentID )
  428. SELECT Path, BuildNo, EntryDate, IncidentID from DBGPortal_CrashData
  429. where iBucket=@iBucket
  430. END
  431. --select Path, BuildNo, EntryDate, IncidentID, Email, Description, Comments, Repro from @TmpTable where Anindex>=(@Page-1)*@PageSize and AnIndex < ((@Page-1) *@PageSize) + @PageSize
  432. select Path, BuildNo, EntryDate, IncidentID, Email, Description, Comments, Repro, TrackID from @TmpTable where Anindex>= ((@Page-1)*@PageSize+1) and AnIndex <= ((@Page) *@PageSize)
  433. GO
  434. SET QUOTED_IDENTIFIER OFF
  435. GO
  436. SET ANSI_NULLS ON
  437. GO
  438. SET QUOTED_IDENTIFIER ON
  439. GO
  440. SET ANSI_NULLS ON
  441. GO
  442. CREATE PROCEDURE DBGP_GetBucketData(
  443. @BucketID varchar(100)
  444. ) AS
  445. --DECLARE @iBucket int
  446. --DECLARE @FollowUp nvarchar(50)
  447. --DECLARE @Crashes int
  448. --DECLARE @SolutionID int
  449. --DECLARE @iFollowup int
  450. --DECLARE @BugID int
  451. DECLARE @BugArea varchar(30)
  452. DECLARE @DriverName varchar(100)
  453. SELECT @BugArea = Area from RaidBugs where BucketID = @BucketID
  454. SELECT @DriverName = DriverName from buckettoint as bti
  455. left join drnames on bti.iDriverName = drnames.iDriverName
  456. where BucketID = @BucketID
  457. --SELECT @iBucket = iBucket, @iFollowup = iFollowup FROM BucketToInt where BucketID = @BucketID
  458. --SELECT @FollowUP = FollowUP from FollowUPIds where iFollowup = @iFollowup
  459. --select @Crashes = count(*) from CrashInstances where sBucket=@iBucket
  460. --SELECT @SolutionID = SolutionID from solutions.dbo.SolvedBuckets where strBucket = @BucketID
  461. --SELECT @BucketID as BucketID, @iBucket as iBucket, @FollowUp as [Follow Up], @Crashes as Crashes, @SolutionID as [Solution ID], @BugID as BugID, @BugArea as Area
  462. SELECT BucketID, iBucket, FollowUp as [Follow Up], CrashCount as Crashes, SolutionID as [Solution ID], BugID, @bugArea as Area, @DriverName as DriverName from DBGPortal_BucketData where BucketID = @BucketID
  463. GO
  464. SET QUOTED_IDENTIFIER OFF
  465. GO
  466. SET ANSI_NULLS ON
  467. GO
  468. SET QUOTED_IDENTIFIER OFF
  469. GO
  470. SET ANSI_NULLS OFF
  471. GO
  472. CREATE PROCEDURE DBGP_GetBucketIDByiBucket(
  473. @iBucket int
  474. )
  475. AS
  476. SELECT BucketID FROM BucketToInt WHERE iBucket = @iBucket
  477. GO
  478. SET QUOTED_IDENTIFIER OFF
  479. GO
  480. SET ANSI_NULLS ON
  481. GO
  482. SET QUOTED_IDENTIFIER OFF
  483. GO
  484. SET ANSI_NULLS OFF
  485. GO
  486. CREATE PROCEDURE DBGP_GetBucketStats (
  487. @Page int = 1,
  488. @PageSize int = 25,
  489. @Solved varchar(10) = 'UnSolved',
  490. @Raided varchar(10) = 'NotRaided',
  491. @OrderBy varchar(20) = 'TotalCrashes',
  492. @SortDir varchar(10) = 'DESC',
  493. @Reserved varchar(20) = 'none',
  494. @NumDays int = 2
  495. ) AS
  496. DECLARE @TotalCrashes decimal (10, 2 )
  497. SELECT @TotalCrashes = COUNT(*) FROM DBGPortal_CrashData
  498. DECLARE @TotalBuckets decimal (10, 2 )
  499. SELECT @TotalBuckets = COUNT(*) FROM DBGPortal_BucketData
  500. DECLARE @TmpTable TABLE (
  501. FollowUp varchar(50),
  502. TotalCrashes int,
  503. [% of Total Hits] decimal(10,2),
  504. BucketCount int,
  505. [% of Total Buckets] decimal(10,2)
  506. )
  507. INSERT INTO @TmpTable (FollowUp, TotalCrashes, [% of Total Hits], BucketCount, [% of Total Buckets] )
  508. SELECT FollowUp,
  509. SUM(CrashCount) as TotalCrashes,
  510. Convert( decimal(10,2), ((CAST( SUM(CrashCount) AS float)*100) / CAST(@TotalCrashes as float))) as [% of Total Hits],
  511. Count(iBucket) as BucketCount,
  512. Convert( decimal(10,2), ((CAST( Count(iBucket) AS float)*100) / CAST(@TotalBuckets as float))) as [% of Total Buckets]
  513. FROM DBGPortal_BucketData
  514. GROUP BY FollowUp
  515. IF (@SortDir = 'DESC' )
  516. BEGIN
  517. print 'order desc'
  518. IF (@OrderBy = 'FollowUp' )
  519. BEGIN
  520. print 'order followup desc'
  521. SELECT * FROM @TmpTable
  522. ORDER BY FollowUp DESC
  523. END
  524. ELSE
  525. BEGIN
  526. print 'order else'
  527. SELECT *
  528. FROM @TmpTable
  529. ORDER BY
  530. CASE @OrderBy
  531. WHEN 'TotalCrashes' THEN TotalCrashes
  532. WHEN '% of total Hits' THEN TotalCrashes
  533. WHEN 'BucketCount' THEN BucketCount
  534. WHEN '% of Total Buckets' THEN BucketCount
  535. END
  536. DESC
  537. END
  538. END
  539. ELSE
  540. BEGIN
  541. print 'order asc'
  542. IF (@OrderBy = 'FollowUp' )
  543. BEGIN
  544. print 'order by followup asc'
  545. SELECT * FROM @TmpTable
  546. ORDER BY FollowUp ASC
  547. END
  548. ELSE
  549. BEGIN
  550. print 'order by other'
  551. SELECT *
  552. FROM @TmpTable
  553. ORDER BY
  554. CASE @OrderBy
  555. WHEN 'TotalCrashes' THEN TotalCrashes
  556. WHEN '% of total Hits' THEN TotalCrashes
  557. WHEN 'BucketCount' THEN BucketCount
  558. WHEN '% of Total Buckets' THEN BucketCount
  559. END
  560. ASC
  561. END
  562. END
  563. --SELECT * from @TmpTable
  564. GO
  565. SET QUOTED_IDENTIFIER OFF
  566. GO
  567. SET ANSI_NULLS ON
  568. GO
  569. SET QUOTED_IDENTIFIER ON
  570. GO
  571. SET ANSI_NULLS OFF
  572. GO
  573. CREATE PROCEDURE DBGP_GetBucketStatus (
  574. @BucketID varchar(100)
  575. ) AS
  576. --IF EXISTS( select * from Comments WHERE iBucket = @BucketID and [Action] = 'closed' )
  577. -- select top 1 [Action], CommentBy from Comments WHERE iBucket = @BucketID AND [Action] = 'closed' order by EntryDate DESC
  578. --ELSE IF EXISTS( SELECT * from Comments WHERE iBucket = @BucketID and [Action] = 'solution requested' )
  579. -- select top 1 [Action], CommentBy from Comments WHERE iBucket = @BucketID and [Action] = 'solution requested' order by EntryDate DESC
  580. --ELSE
  581. -- select top 1 [Action], CommentBy from Comments WHERE iBucket = @BucketID order by EntryDate DESC
  582. --GO
  583. select TOP 1 MAX(ActionID) as BiggestComment, [Action], CommentBy from Comments WHERE BucketID = @BucketID and ActionID != 7 -- order by EntryDate DESC
  584. group by [Action], CommentBy ORDER BY BiggestComment DESC
  585. GO
  586. SET QUOTED_IDENTIFIER OFF
  587. GO
  588. SET ANSI_NULLS ON
  589. GO
  590. SET QUOTED_IDENTIFIER ON
  591. GO
  592. SET ANSI_NULLS OFF
  593. GO
  594. CREATE PROCEDURE DBGP_GetBuckets(
  595. @Page int = 1,
  596. @PageSize int = 25,
  597. @Solved varchar(10) = 'UnSolved',
  598. @Raided varchar(10) = 'NotRaided',
  599. @OrderBy varchar(10) = 'CrashCount',
  600. @SortDir varchar(10) = 'DESC',
  601. @Alias varchar(20) = 'none',
  602. @Reserved int = 0
  603. ) AS
  604. DECLARE @EndRow int
  605. SET @EndRow = (@Page*@PageSize) + 1
  606. SET ROWCOUNT @EndRow
  607. --declare @Solved varchar(10)
  608. --declare @Raided varchar(10)
  609. --declare @page int
  610. --declare @pagesize int
  611. --declare @OrderBy varchar(10)
  612. --declare @SortDir varchar(10)
  613. --set @Solved = 'nSolved'
  614. --set @Raided = 'raided'
  615. --set @Page = 1
  616. --set @PageSize = 50
  617. --set @OrderBy = 'Followup'
  618. --set @SortDir = 'ASC'
  619. declare @tmpTable Table(
  620. AnIndex int IDENTITY(1,1) NOT NULL,
  621. -- [BucketIndex] [int],
  622. iBucket int,
  623. BucketID varchar(100),
  624. FollowUp varchar(50),
  625. CrashCount int ,
  626. BugID int ,
  627. SolutionID int
  628. )
  629. IF ( @Solved = 'Solved' )
  630. BEGIN
  631. IF ( @Raided = 'Raided' )
  632. BEGIN
  633. IF ( @SortDir = 'DESC' )
  634. BEGIN
  635. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  636. BEGIN
  637. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  638. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  639. WHERE SolutionID IS not null and BugID IS NOT Null
  640. ORDER BY
  641. CASE @OrderBy
  642. WHEN 'BucketID' THEN BucketID
  643. WHEN 'FollowUp' THEN FollowUP
  644. END
  645. DESC
  646. END
  647. ELSE
  648. BEGIN
  649. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  650. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  651. WHERE SolutionID IS not null and BugID IS NOT Null
  652. ORDER BY
  653. CASE @OrderBy
  654. WHEN 'iBucket' THEN iBucket
  655. WHEN 'CrashCount' THEN CrashCount
  656. WHEN 'BugID' THEN BugID
  657. WHEN 'SolutionID' THEN SolutionID
  658. END
  659. DESC
  660. END
  661. END
  662. ELSE
  663. BEGIN
  664. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  665. BEGIN
  666. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  667. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  668. WHERE SolutionID IS not null and BugID IS NOT Null
  669. ORDER BY
  670. CASE @OrderBy
  671. WHEN 'BucketID' THEN BucketID
  672. WHEN 'FollowUp' THEN FollowUP
  673. END
  674. ASC
  675. END
  676. ELSE
  677. BEGIN
  678. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  679. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  680. WHERE SolutionID IS not null and BugID IS NOT Null
  681. ORDER BY
  682. CASE @OrderBy
  683. WHEN 'iBucket' THEN iBucket
  684. WHEN 'CrashCount' THEN CrashCount
  685. WHEN 'BugID' THEN BugID
  686. WHEN 'SolutionID' THEN SolutionID
  687. END
  688. ASC
  689. END
  690. END
  691. END
  692. ELSE IF ( @Raided = 'NotRaided' )
  693. BEGIN
  694. IF ( @SortDir = 'DESC' )
  695. BEGIN
  696. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  697. BEGIN
  698. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  699. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  700. WHERE SolutionID IS not null and BugID IS Null
  701. ORDER BY
  702. CASE @OrderBy
  703. WHEN 'BucketID' THEN BucketID
  704. WHEN 'FollowUp' THEN FollowUP
  705. END
  706. DESC
  707. END
  708. ELSE
  709. BEGIN
  710. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  711. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  712. WHERE SolutionID IS not null and BugID IS Null
  713. ORDER BY
  714. CASE @OrderBy
  715. WHEN 'iBucket' THEN iBucket
  716. WHEN 'CrashCount' THEN CrashCount
  717. WHEN 'BugID' THEN BugID
  718. WHEN 'SolutionID' THEN SolutionID
  719. END
  720. DESC
  721. END
  722. END
  723. ELSE
  724. BEGIN
  725. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  726. BEGIN
  727. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  728. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  729. WHERE SolutionID IS not null and BugID IS Null
  730. ORDER BY
  731. CASE @OrderBy
  732. WHEN 'BucketID' THEN BucketID
  733. WHEN 'FollowUp' THEN FollowUP
  734. END
  735. ASC
  736. END
  737. ELSE
  738. BEGIN
  739. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  740. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  741. WHERE SolutionID IS not null and BugID IS Null
  742. ORDER BY
  743. CASE @OrderBy
  744. WHEN 'iBucket' THEN iBucket
  745. WHEN 'CrashCount' THEN CrashCount
  746. WHEN 'BugID' THEN BugID
  747. WHEN 'SolutionID' THEN SolutionID
  748. END
  749. ASC
  750. END
  751. END
  752. END
  753. ELSE IF ( @Raided = 'All' )
  754. BEGIN
  755. IF ( @SortDir = 'DESC' )
  756. BEGIN
  757. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  758. BEGIN
  759. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  760. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  761. WHERE SolutionID IS not null
  762. ORDER BY
  763. CASE @OrderBy
  764. WHEN 'BucketID' THEN BucketID
  765. WHEN 'FollowUp' THEN FollowUP
  766. END
  767. DESC
  768. END
  769. ELSE
  770. BEGIN
  771. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  772. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  773. WHERE SolutionID IS not null
  774. ORDER BY
  775. CASE @OrderBy
  776. WHEN 'iBucket' THEN iBucket
  777. WHEN 'CrashCount' THEN CrashCount
  778. WHEN 'BugID' THEN BugID
  779. WHEN 'SolutionID' THEN SolutionID
  780. END
  781. DESC
  782. END
  783. END
  784. ELSE
  785. BEGIN
  786. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  787. BEGIN
  788. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  789. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  790. WHERE SolutionID IS not null
  791. ORDER BY
  792. CASE @OrderBy
  793. WHEN 'BucketID' THEN BucketID
  794. WHEN 'FollowUp' THEN FollowUP
  795. END
  796. ASC
  797. END
  798. ELSE
  799. BEGIN
  800. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  801. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  802. WHERE SolutionID IS not null
  803. ORDER BY
  804. CASE @OrderBy
  805. WHEN 'iBucket' THEN iBucket
  806. WHEN 'CrashCount' THEN CrashCount
  807. WHEN 'BugID' THEN BugID
  808. WHEN 'SolutionID' THEN SolutionID
  809. END
  810. ASC
  811. END
  812. END
  813. END
  814. END
  815. ELSE IF ( @Solved = 'UnSolved' )
  816. BEGIN
  817. IF ( @Raided = 'Raided' )
  818. BEGIN
  819. IF ( @SortDir = 'DESC' )
  820. BEGIN
  821. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  822. BEGIN
  823. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  824. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  825. WHERE SolutionID IS null and BugID IS NOT Null
  826. ORDER BY
  827. CASE @OrderBy
  828. WHEN 'BucketID' THEN BucketID
  829. WHEN 'FollowUp' THEN FollowUP
  830. END
  831. DESC
  832. END
  833. ELSE
  834. BEGIN
  835. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  836. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  837. WHERE SolutionID IS null and BugID IS NOT Null
  838. ORDER BY
  839. CASE @OrderBy
  840. WHEN 'iBucket' THEN iBucket
  841. WHEN 'CrashCount' THEN CrashCount
  842. WHEN 'BugID' THEN BugID
  843. WHEN 'SolutionID' THEN SolutionID
  844. END
  845. DESC
  846. END
  847. END
  848. ELSE
  849. BEGIN
  850. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  851. BEGIN
  852. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  853. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  854. WHERE SolutionID IS null and BugID IS NOT Null
  855. ORDER BY
  856. CASE @OrderBy
  857. WHEN 'BucketID' THEN BucketID
  858. WHEN 'FollowUp' THEN FollowUP
  859. END
  860. ASC
  861. END
  862. ELSE
  863. BEGIN
  864. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  865. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  866. WHERE SolutionID IS null and BugID IS NOT Null
  867. ORDER BY
  868. CASE @OrderBy
  869. WHEN 'iBucket' THEN iBucket
  870. WHEN 'CrashCount' THEN CrashCount
  871. WHEN 'BugID' THEN BugID
  872. WHEN 'SolutionID' THEN SolutionID
  873. END
  874. ASC
  875. END
  876. END
  877. END
  878. ELSE IF ( @Raided = 'NotRaided' )
  879. BEGIN
  880. IF ( @SortDir = 'DESC' )
  881. BEGIN
  882. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  883. BEGIN
  884. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  885. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  886. WHERE SolutionID IS null and BugID IS Null
  887. ORDER BY
  888. CASE @OrderBy
  889. WHEN 'BucketID' THEN BucketID
  890. WHEN 'FollowUp' THEN FollowUP
  891. END
  892. DESC
  893. END
  894. ELSE IF @OrderBy = 'iBucket' OR @OrderBy = 'BugID' OR @OrderBy = 'SolutionID'
  895. BEGIN
  896. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  897. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  898. WHERE SolutionID IS null and BugID IS Null
  899. ORDER BY
  900. CASE @OrderBy
  901. WHEN 'iBucket' THEN iBucket
  902. --WHEN 'CrashCount' THEN CrashCount
  903. WHEN 'BugID' THEN BugID
  904. WHEN 'SolutionID' THEN SolutionID
  905. END
  906. DESC
  907. END
  908. ELSE
  909. BEGIN
  910. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID
  911. FROM DBGPortal_BucketData
  912. WHERE BucketIndex>=((@Page-1)*@PageSize+1) and BucketIndex <= ((@Page) *@PageSize) AND SolutionID IS NULL AND BugID is NULL
  913. RETURN
  914. END
  915. END
  916. ELSE
  917. BEGIN
  918. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  919. BEGIN
  920. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  921. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  922. WHERE SolutionID IS null and BugID IS Null
  923. ORDER BY
  924. CASE @OrderBy
  925. WHEN 'BucketID' THEN BucketID
  926. WHEN 'FollowUp' THEN FollowUP
  927. END
  928. ASC
  929. END
  930. ELSE
  931. BEGIN
  932. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  933. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  934. WHERE SolutionID IS null and BugID IS Null
  935. ORDER BY
  936. CASE @OrderBy
  937. WHEN 'iBucket' THEN iBucket
  938. WHEN 'CrashCount' THEN CrashCount
  939. WHEN 'BugID' THEN BugID
  940. WHEN 'SolutionID' THEN SolutionID
  941. END
  942. ASC
  943. END
  944. END
  945. END
  946. --unsolved all
  947. ELSE IF ( @Raided = 'All' )
  948. BEGIN
  949. IF ( @SortDir = 'DESC' )
  950. BEGIN
  951. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  952. BEGIN
  953. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  954. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  955. WHERE SolutionID IS null
  956. ORDER BY
  957. CASE @OrderBy
  958. WHEN 'BucketID' THEN BucketID
  959. WHEN 'FollowUp' THEN FollowUP
  960. END
  961. DESC
  962. END
  963. ELSE IF @OrderBy = 'iBucket' OR @OrderBy = 'BugID' OR @OrderBy = 'SolutionID' or @OrderBy = 'CrashCount'
  964. BEGIN
  965. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  966. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  967. WHERE SolutionID IS null
  968. ORDER BY
  969. CASE @OrderBy
  970. WHEN 'iBucket' THEN iBucket
  971. WHEN 'CrashCount' THEN CrashCount
  972. WHEN 'BugID' THEN BugID
  973. WHEN 'SolutionID' THEN SolutionID
  974. END
  975. DESC
  976. END
  977. END
  978. ELSE
  979. BEGIN
  980. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  981. BEGIN
  982. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  983. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  984. WHERE SolutionID IS null
  985. ORDER BY
  986. CASE @OrderBy
  987. WHEN 'BucketID' THEN BucketID
  988. WHEN 'FollowUp' THEN FollowUP
  989. END
  990. ASC
  991. END
  992. ELSE
  993. BEGIN
  994. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  995. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  996. WHERE SolutionID IS null
  997. ORDER BY
  998. CASE @OrderBy
  999. WHEN 'iBucket' THEN iBucket
  1000. WHEN 'CrashCount' THEN CrashCount
  1001. WHEN 'BugID' THEN BugID
  1002. WHEN 'SolutionID' THEN SolutionID
  1003. END
  1004. ASC
  1005. END
  1006. END
  1007. END
  1008. END
  1009. ELSE IF ( @Solved = 'all' )
  1010. BEGIN
  1011. IF ( @Raided = 'Raided' )
  1012. BEGIN
  1013. IF ( @SortDir = 'DESC' )
  1014. BEGIN
  1015. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  1016. BEGIN
  1017. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1018. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1019. WHERE BugID IS NOT Null
  1020. ORDER BY
  1021. CASE @OrderBy
  1022. WHEN 'BucketID' THEN BucketID
  1023. WHEN 'FollowUp' THEN FollowUP
  1024. END
  1025. DESC
  1026. END
  1027. ELSE --else order by
  1028. BEGIN
  1029. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1030. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1031. WHERE BugID IS NOT Null
  1032. ORDER BY
  1033. CASE @OrderBy
  1034. WHEN 'iBucket' THEN iBucket
  1035. WHEN 'CrashCount' THEN CrashCount
  1036. WHEN 'BugID' THEN BugID
  1037. WHEN 'SolutionID' THEN SolutionID
  1038. END
  1039. DESC
  1040. END
  1041. END
  1042. ELSE
  1043. BEGIN
  1044. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  1045. BEGIN
  1046. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1047. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1048. WHERE BugID IS NOT Null
  1049. ORDER BY
  1050. CASE @OrderBy
  1051. WHEN 'BucketID' THEN BucketID
  1052. WHEN 'FollowUp' THEN FollowUP
  1053. END
  1054. ASC
  1055. END
  1056. ELSE
  1057. BEGIN
  1058. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1059. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1060. WHERE BugID IS NOT Null
  1061. ORDER BY
  1062. CASE @OrderBy
  1063. WHEN 'iBucket' THEN iBucket
  1064. WHEN 'CrashCount' THEN CrashCount
  1065. WHEN 'BugID' THEN BugID
  1066. WHEN 'SolutionID' THEN SolutionID
  1067. END
  1068. ASC
  1069. END
  1070. END
  1071. END
  1072. ELSE IF ( @Raided = 'NotRaided' )
  1073. BEGIN
  1074. IF ( @SortDir = 'DESC' )
  1075. BEGIN
  1076. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  1077. BEGIN
  1078. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1079. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1080. WHERE BugID IS Null
  1081. ORDER BY
  1082. CASE @OrderBy
  1083. WHEN 'BucketID' THEN BucketID
  1084. WHEN 'FollowUp' THEN FollowUP
  1085. END
  1086. DESC
  1087. END
  1088. ELSE IF @OrderBy = 'iBucket' OR @OrderBy = 'BugID' OR @OrderBy = 'SolutionID'
  1089. BEGIN
  1090. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1091. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1092. WHERE BugID IS Null
  1093. ORDER BY
  1094. CASE @OrderBy
  1095. WHEN 'iBucket' THEN iBucket
  1096. --WHEN 'CrashCount' THEN CrashCount
  1097. WHEN 'BugID' THEN BugID
  1098. WHEN 'SolutionID' THEN SolutionID
  1099. END
  1100. DESC
  1101. END
  1102. ELSE
  1103. BEGIN
  1104. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID
  1105. FROM DBGPortal_BucketData
  1106. WHERE BucketIndex>=((@Page-1)*@PageSize+1) and BucketIndex <= ((@Page) *@PageSize) AND BugID is NULL
  1107. RETURN
  1108. END
  1109. END
  1110. ELSE
  1111. BEGIN
  1112. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  1113. BEGIN
  1114. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1115. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1116. WHERE BugID IS Null
  1117. ORDER BY
  1118. CASE @OrderBy
  1119. WHEN 'BucketID' THEN BucketID
  1120. WHEN 'FollowUp' THEN FollowUP
  1121. END
  1122. ASC
  1123. END
  1124. ELSE
  1125. BEGIN
  1126. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1127. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1128. WHERE BugID IS Null
  1129. ORDER BY
  1130. CASE @OrderBy
  1131. WHEN 'iBucket' THEN iBucket
  1132. WHEN 'CrashCount' THEN CrashCount
  1133. WHEN 'BugID' THEN BugID
  1134. WHEN 'SolutionID' THEN SolutionID
  1135. END
  1136. ASC
  1137. END
  1138. END
  1139. END
  1140. --unsolved all
  1141. ELSE IF ( @Raided = 'All' )
  1142. BEGIN
  1143. IF ( @SortDir = 'DESC' )
  1144. BEGIN
  1145. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  1146. BEGIN
  1147. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1148. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1149. ORDER BY
  1150. CASE @OrderBy
  1151. WHEN 'BucketID' THEN BucketID
  1152. WHEN 'FollowUp' THEN FollowUP
  1153. END
  1154. DESC
  1155. END
  1156. ELSE IF @OrderBy = 'iBucket' OR @OrderBy = 'BugID' OR @OrderBy = 'SolutionID' OR @orderBy = 'CrashCount'
  1157. BEGIN
  1158. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1159. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1160. ORDER BY
  1161. CASE @OrderBy
  1162. WHEN 'iBucket' THEN iBucket
  1163. WHEN 'CrashCount' THEN CrashCount
  1164. WHEN 'BugID' THEN BugID
  1165. WHEN 'SolutionID' THEN SolutionID
  1166. END
  1167. DESC
  1168. END
  1169. END
  1170. ELSE
  1171. BEGIN
  1172. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  1173. BEGIN
  1174. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1175. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1176. ORDER BY
  1177. CASE @OrderBy
  1178. WHEN 'BucketID' THEN BucketID
  1179. WHEN 'FollowUp' THEN FollowUP
  1180. END
  1181. ASC
  1182. END
  1183. ELSE
  1184. BEGIN
  1185. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1186. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1187. ORDER BY
  1188. CASE @OrderBy
  1189. WHEN 'iBucket' THEN iBucket
  1190. WHEN 'CrashCount' THEN CrashCount
  1191. WHEN 'BugID' THEN BugID
  1192. WHEN 'SolutionID' THEN SolutionID
  1193. END
  1194. ASC
  1195. END
  1196. END
  1197. END
  1198. END
  1199. select iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID from @TmpTable where Anindex>= ((@Page-1)*@PageSize+1) and AnIndex <= ((@Page) *@PageSize)
  1200. SET ROWCOUNT 0
  1201. GO
  1202. SET QUOTED_IDENTIFIER OFF
  1203. GO
  1204. SET ANSI_NULLS ON
  1205. GO
  1206. SET QUOTED_IDENTIFIER ON
  1207. GO
  1208. SET ANSI_NULLS ON
  1209. GO
  1210. CREATE PROCEDURE DBGP_GetBucketsByAlias(
  1211. @Page int = 1,
  1212. @PageSize int = 25,
  1213. @Solved varchar(10) = 'notSolved',
  1214. @Raided varchar(10) = 'notRaided',
  1215. @OrderBy varchar(10) = 'CrashCount',
  1216. @SortDir varchar(10) = 'DESC',
  1217. @Alias varchar(50) = 'dbg'
  1218. ) AS
  1219. declare @tmpTable Table(
  1220. AnIndex int IDENTITY(1,1) NOT NULL,
  1221. -- [BucketIndex] [int],
  1222. iBucket int,
  1223. BucketID varchar(100),
  1224. FollowUp varchar(50),
  1225. CrashCount int ,
  1226. BugID int ,
  1227. SolutionID int
  1228. )
  1229. IF ( @Solved = 'Solved' )
  1230. BEGIN
  1231. IF ( @Raided = 'Raided' )
  1232. BEGIN
  1233. IF ( @SortDir = 'DESC' )
  1234. BEGIN
  1235. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  1236. BEGIN
  1237. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1238. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1239. WHERE SolutionID IS not null and BugID IS NOT Null AND FollowUp = @Alias
  1240. ORDER BY
  1241. CASE @OrderBy
  1242. WHEN 'BucketID' THEN BucketID
  1243. WHEN 'FollowUp' THEN FollowUP
  1244. END
  1245. DESC
  1246. END
  1247. ELSE
  1248. BEGIN
  1249. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1250. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1251. WHERE SolutionID IS not null and BugID IS NOT Null AND FollowUp = @Alias
  1252. ORDER BY
  1253. CASE @OrderBy
  1254. WHEN 'iBucket' THEN iBucket
  1255. WHEN 'CrashCount' THEN CrashCount
  1256. WHEN 'BugID' THEN BugID
  1257. WHEN 'SolutionID' THEN SolutionID
  1258. END
  1259. DESC
  1260. END
  1261. END
  1262. ELSE
  1263. BEGIN
  1264. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  1265. BEGIN
  1266. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1267. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1268. WHERE SolutionID IS not null and BugID IS NOT Null AND FollowUp = @Alias
  1269. ORDER BY
  1270. CASE @OrderBy
  1271. WHEN 'BucketID' THEN BucketID
  1272. WHEN 'FollowUp' THEN FollowUP
  1273. END
  1274. ASC
  1275. END
  1276. ELSE
  1277. BEGIN
  1278. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1279. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1280. WHERE SolutionID IS not null and BugID IS NOT Null AND FollowUp = @Alias
  1281. ORDER BY
  1282. CASE @OrderBy
  1283. WHEN 'iBucket' THEN iBucket
  1284. WHEN 'CrashCount' THEN CrashCount
  1285. WHEN 'BugID' THEN BugID
  1286. WHEN 'SolutionID' THEN SolutionID
  1287. END
  1288. ASC
  1289. END
  1290. END
  1291. END
  1292. ELSE
  1293. BEGIN
  1294. IF ( @SortDir = 'DESC' )
  1295. BEGIN
  1296. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  1297. BEGIN
  1298. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1299. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1300. WHERE SolutionID IS not null AND FollowUp = @Alias --and BugID IS Null
  1301. ORDER BY
  1302. CASE @OrderBy
  1303. WHEN 'BucketID' THEN BucketID
  1304. WHEN 'FollowUp' THEN FollowUP
  1305. END
  1306. DESC
  1307. END
  1308. ELSE
  1309. BEGIN
  1310. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1311. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1312. WHERE SolutionID IS not null AND FollowUp = @Alias--and BugID IS Null
  1313. ORDER BY
  1314. CASE @OrderBy
  1315. WHEN 'iBucket' THEN iBucket
  1316. WHEN 'CrashCount' THEN CrashCount
  1317. WHEN 'BugID' THEN BugID
  1318. WHEN 'SolutionID' THEN SolutionID
  1319. END
  1320. DESC
  1321. END
  1322. END
  1323. ELSE
  1324. BEGIN
  1325. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  1326. BEGIN
  1327. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1328. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1329. WHERE SolutionID IS not null AND FollowUp = @Alias--and BugID IS Null
  1330. ORDER BY
  1331. CASE @OrderBy
  1332. WHEN 'BucketID' THEN BucketID
  1333. WHEN 'FollowUp' THEN FollowUP
  1334. END
  1335. ASC
  1336. END
  1337. ELSE
  1338. BEGIN
  1339. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1340. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1341. WHERE SolutionID IS not null AND FollowUp = @Alias--and BugID IS Null
  1342. ORDER BY
  1343. CASE @OrderBy
  1344. WHEN 'iBucket' THEN iBucket
  1345. WHEN 'CrashCount' THEN CrashCount
  1346. WHEN 'BugID' THEN BugID
  1347. WHEN 'SolutionID' THEN SolutionID
  1348. END
  1349. ASC
  1350. END
  1351. END
  1352. END
  1353. END
  1354. ELSE IF ( @Solved = 'unSolved' ) --end if Solved
  1355. BEGIN
  1356. IF ( @Raided = 'Raided' )
  1357. BEGIN
  1358. IF ( @SortDir = 'DESC' )
  1359. BEGIN
  1360. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  1361. BEGIN
  1362. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1363. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1364. WHERE SolutionID IS null and BugID IS NOT Null AND FollowUp = @Alias
  1365. ORDER BY
  1366. CASE @OrderBy
  1367. WHEN 'BucketID' THEN BucketID
  1368. WHEN 'FollowUp' THEN FollowUP
  1369. END
  1370. DESC
  1371. END
  1372. ELSE
  1373. BEGIN
  1374. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1375. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1376. WHERE SolutionID IS null and BugID IS NOT Null AND FollowUp = @Alias
  1377. ORDER BY
  1378. CASE @OrderBy
  1379. WHEN 'iBucket' THEN iBucket
  1380. WHEN 'CrashCount' THEN CrashCount
  1381. WHEN 'BugID' THEN BugID
  1382. WHEN 'SolutionID' THEN SolutionID
  1383. END
  1384. DESC
  1385. END
  1386. END
  1387. ELSE
  1388. BEGIN
  1389. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  1390. BEGIN
  1391. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1392. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1393. WHERE SolutionID IS null and BugID IS NOT Null AND FollowUp = @Alias
  1394. ORDER BY
  1395. CASE @OrderBy
  1396. WHEN 'BucketID' THEN BucketID
  1397. WHEN 'FollowUp' THEN FollowUP
  1398. END
  1399. ASC
  1400. END
  1401. ELSE
  1402. BEGIN
  1403. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1404. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1405. WHERE SolutionID IS null and BugID IS NOT Null AND FollowUp = @Alias
  1406. ORDER BY
  1407. CASE @OrderBy
  1408. WHEN 'iBucket' THEN iBucket
  1409. WHEN 'CrashCount' THEN CrashCount
  1410. WHEN 'BugID' THEN BugID
  1411. WHEN 'SolutionID' THEN SolutionID
  1412. END
  1413. ASC
  1414. END
  1415. END
  1416. END
  1417. ELSE IF ( @Raided = 'notRaided' )
  1418. BEGIN
  1419. IF ( @SortDir = 'DESC' )
  1420. BEGIN
  1421. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  1422. BEGIN
  1423. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1424. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1425. WHERE SolutionID IS null and BugID IS Null AND FollowUp = @Alias
  1426. ORDER BY
  1427. CASE @OrderBy
  1428. WHEN 'BucketID' THEN BucketID
  1429. WHEN 'FollowUp' THEN FollowUP
  1430. END
  1431. DESC
  1432. END
  1433. ELSE --IF @OrderBy = 'iBucket' OR @OrderBy = 'BugID' OR @OrderBy = 'SolutionID'
  1434. BEGIN
  1435. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1436. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1437. WHERE SolutionID IS null and BugID IS Null AND FollowUp = @Alias
  1438. ORDER BY
  1439. CASE @OrderBy
  1440. WHEN 'iBucket' THEN iBucket
  1441. WHEN 'CrashCount' THEN CrashCount
  1442. WHEN 'BugID' THEN BugID
  1443. WHEN 'SolutionID' THEN SolutionID
  1444. END
  1445. DESC
  1446. END
  1447. -- ELSE
  1448. -- BEGIN
  1449. -- SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID
  1450. -- FROM DBGPortal_BucketData
  1451. -- WHERE BucketIndex>=(@Page-1)*@PageSize and BucketIndex < ((@Page-1) *@PageSize) + @PageSize AND SolutionID IS NULL AND BugID is NULL AND FollowUp = @Alias
  1452. -- END
  1453. END
  1454. ELSE --this else is for the sortdirection
  1455. BEGIN
  1456. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  1457. BEGIN
  1458. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1459. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1460. WHERE SolutionID IS null and BugID IS Null AND FollowUp = @Alias
  1461. ORDER BY
  1462. CASE @OrderBy
  1463. WHEN 'BucketID' THEN BucketID
  1464. WHEN 'FollowUp' THEN FollowUP
  1465. END
  1466. ASC
  1467. END
  1468. ELSE
  1469. BEGIN
  1470. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1471. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1472. WHERE SolutionID IS null and BugID IS Null AND FollowUp = @Alias
  1473. ORDER BY
  1474. CASE @OrderBy
  1475. WHEN 'iBucket' THEN iBucket
  1476. WHEN 'CrashCount' THEN CrashCount
  1477. WHEN 'BugID' THEN BugID
  1478. WHEN 'SolutionID' THEN SolutionID
  1479. END
  1480. ASC
  1481. END
  1482. END
  1483. END
  1484. ELSE IF ( @Raided = 'all' )
  1485. BEGIN
  1486. IF ( @SortDir = 'DESC' )
  1487. BEGIN
  1488. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  1489. BEGIN
  1490. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1491. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1492. WHERE SolutionID IS null AND FollowUp = @Alias
  1493. ORDER BY
  1494. CASE @OrderBy
  1495. WHEN 'BucketID' THEN BucketID
  1496. WHEN 'FollowUp' THEN FollowUP
  1497. END
  1498. DESC
  1499. END
  1500. ELSE --IF @OrderBy = 'iBucket' OR @OrderBy = 'BugID' OR @OrderBy = 'SolutionID'
  1501. BEGIN
  1502. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1503. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1504. WHERE SolutionID IS null AND FollowUp = @Alias
  1505. ORDER BY
  1506. CASE @OrderBy
  1507. WHEN 'iBucket' THEN iBucket
  1508. WHEN 'CrashCount' THEN CrashCount
  1509. WHEN 'BugID' THEN BugID
  1510. WHEN 'SolutionID' THEN SolutionID
  1511. END
  1512. DESC
  1513. END
  1514. END
  1515. ELSE --this else is for the sortdirection
  1516. BEGIN
  1517. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  1518. BEGIN
  1519. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1520. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1521. WHERE SolutionID IS null AND FollowUp = @Alias
  1522. ORDER BY
  1523. CASE @OrderBy
  1524. WHEN 'BucketID' THEN BucketID
  1525. WHEN 'FollowUp' THEN FollowUP
  1526. END
  1527. ASC
  1528. END
  1529. ELSE
  1530. BEGIN
  1531. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1532. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1533. WHERE SolutionID IS null AND FollowUp = @Alias
  1534. ORDER BY
  1535. CASE @OrderBy
  1536. WHEN 'iBucket' THEN iBucket
  1537. WHEN 'CrashCount' THEN CrashCount
  1538. WHEN 'BugID' THEN BugID
  1539. WHEN 'SolutionID' THEN SolutionID
  1540. END
  1541. ASC
  1542. END
  1543. END
  1544. END
  1545. END
  1546. ELSE IF ( @Solved = 'all' )
  1547. BEGIN
  1548. IF ( @Raided = 'Raided' )
  1549. BEGIN
  1550. IF ( @SortDir = 'DESC' )
  1551. BEGIN
  1552. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  1553. BEGIN
  1554. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1555. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1556. WHERE BugID IS NOT Null AND FollowUp = @Alias
  1557. ORDER BY
  1558. CASE @OrderBy
  1559. WHEN 'BucketID' THEN BucketID
  1560. WHEN 'FollowUp' THEN FollowUP
  1561. END
  1562. DESC
  1563. END
  1564. ELSE
  1565. BEGIN
  1566. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1567. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1568. WHERE BugID IS NOT Null AND FollowUp = @Alias
  1569. ORDER BY
  1570. CASE @OrderBy
  1571. WHEN 'iBucket' THEN iBucket
  1572. WHEN 'CrashCount' THEN CrashCount
  1573. WHEN 'BugID' THEN BugID
  1574. WHEN 'SolutionID' THEN SolutionID
  1575. END
  1576. DESC
  1577. END
  1578. END
  1579. ELSE
  1580. BEGIN
  1581. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  1582. BEGIN
  1583. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1584. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1585. WHERE BugID IS NOT Null AND FollowUp = @Alias
  1586. ORDER BY
  1587. CASE @OrderBy
  1588. WHEN 'BucketID' THEN BucketID
  1589. WHEN 'FollowUp' THEN FollowUP
  1590. END
  1591. ASC
  1592. END
  1593. ELSE
  1594. BEGIN
  1595. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1596. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1597. WHERE BugID IS NOT Null AND FollowUp = @Alias
  1598. ORDER BY
  1599. CASE @OrderBy
  1600. WHEN 'iBucket' THEN iBucket
  1601. WHEN 'CrashCount' THEN CrashCount
  1602. WHEN 'BugID' THEN BugID
  1603. WHEN 'SolutionID' THEN SolutionID
  1604. END
  1605. ASC
  1606. END
  1607. END
  1608. END --end raided
  1609. ELSE IF ( @Raided = 'notRaided' )
  1610. BEGIN
  1611. IF ( @SortDir = 'DESC' )
  1612. BEGIN
  1613. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  1614. BEGIN
  1615. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1616. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1617. WHERE BugID IS Null AND FollowUp = @Alias
  1618. ORDER BY
  1619. CASE @OrderBy
  1620. WHEN 'BucketID' THEN BucketID
  1621. WHEN 'FollowUp' THEN FollowUP
  1622. END
  1623. DESC
  1624. END
  1625. ELSE --IF @OrderBy = 'iBucket' OR @OrderBy = 'BugID' OR @OrderBy = 'SolutionID'
  1626. BEGIN
  1627. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1628. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1629. WHERE BugID IS Null AND FollowUp = @Alias
  1630. ORDER BY
  1631. CASE @OrderBy
  1632. WHEN 'iBucket' THEN iBucket
  1633. WHEN 'CrashCount' THEN CrashCount
  1634. WHEN 'BugID' THEN BugID
  1635. WHEN 'SolutionID' THEN SolutionID
  1636. END
  1637. DESC
  1638. END
  1639. END
  1640. ELSE --this else is for the sortdirection
  1641. BEGIN
  1642. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  1643. BEGIN
  1644. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1645. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1646. WHERE BugID IS Null AND FollowUp = @Alias
  1647. ORDER BY
  1648. CASE @OrderBy
  1649. WHEN 'BucketID' THEN BucketID
  1650. WHEN 'FollowUp' THEN FollowUP
  1651. END
  1652. ASC
  1653. END
  1654. ELSE
  1655. BEGIN
  1656. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1657. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1658. WHERE BugID IS Null AND FollowUp = @Alias
  1659. ORDER BY
  1660. CASE @OrderBy
  1661. WHEN 'iBucket' THEN iBucket
  1662. WHEN 'CrashCount' THEN CrashCount
  1663. WHEN 'BugID' THEN BugID
  1664. WHEN 'SolutionID' THEN SolutionID
  1665. END
  1666. ASC
  1667. END
  1668. END
  1669. END
  1670. ELSE IF ( @Raided = 'All' )
  1671. BEGIN
  1672. IF ( @SortDir = 'DESC' )
  1673. BEGIN
  1674. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  1675. BEGIN
  1676. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1677. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1678. WHERE FollowUp = @Alias
  1679. ORDER BY
  1680. CASE @OrderBy
  1681. WHEN 'BucketID' THEN BucketID
  1682. WHEN 'FollowUp' THEN FollowUP
  1683. END
  1684. DESC
  1685. END
  1686. ELSE --IF @OrderBy = 'iBucket' OR @OrderBy = 'BugID' OR @OrderBy = 'SolutionID'
  1687. BEGIN
  1688. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1689. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1690. WHERE FollowUp = @Alias
  1691. ORDER BY
  1692. CASE @OrderBy
  1693. WHEN 'iBucket' THEN iBucket
  1694. WHEN 'CrashCount' THEN CrashCount
  1695. WHEN 'BugID' THEN BugID
  1696. WHEN 'SolutionID' THEN SolutionID
  1697. END
  1698. DESC
  1699. END
  1700. END
  1701. ELSE --this else is for the sortdirection
  1702. BEGIN
  1703. IF @OrderBy = 'BucketID' or @OrderBy = 'FollowUp'
  1704. BEGIN
  1705. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1706. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1707. WHERE FollowUp = @Alias
  1708. ORDER BY
  1709. CASE @OrderBy
  1710. WHEN 'BucketID' THEN BucketID
  1711. WHEN 'FollowUp' THEN FollowUP
  1712. END
  1713. ASC
  1714. END
  1715. ELSE
  1716. BEGIN
  1717. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1718. SELECT iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID FROM DBGPortal_BucketData
  1719. WHERE FollowUp = @Alias
  1720. ORDER BY
  1721. CASE @OrderBy
  1722. WHEN 'iBucket' THEN iBucket
  1723. WHEN 'CrashCount' THEN CrashCount
  1724. WHEN 'BugID' THEN BugID
  1725. WHEN 'SolutionID' THEN SolutionID
  1726. END
  1727. ASC
  1728. END
  1729. END
  1730. END
  1731. END
  1732. select iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID from @TmpTable where Anindex>= ((@Page-1)*@PageSize+1) and AnIndex <= ((@Page) *@PageSize)
  1733. GO
  1734. SET QUOTED_IDENTIFIER OFF
  1735. GO
  1736. SET ANSI_NULLS ON
  1737. GO
  1738. SET QUOTED_IDENTIFIER ON
  1739. GO
  1740. SET ANSI_NULLS OFF
  1741. GO
  1742. CREATE PROCEDURE DBGP_GetBucketsByElapsedTime(
  1743. @Page int = 1,
  1744. @PageSize int = 25,
  1745. @Solved varchar(10) = 'UnSolved',
  1746. @Raided varchar(10) = 'NotRaided',
  1747. @OrderBy varchar(10) = 'CrashCount',
  1748. @SortDir varchar(10) = 'DESC',
  1749. @Reserved varchar(20) = 'none',
  1750. @NumDays int = 2
  1751. ) AS
  1752. declare @tmpTable Table(
  1753. AnIndex int IDENTITY(1,1) NOT NULL,
  1754. -- [BucketIndex] [int],
  1755. iBucket int,
  1756. BucketID varchar(100),
  1757. FollowUp varchar(50),
  1758. CrashCount int ,
  1759. BugID int ,
  1760. SolutionID int
  1761. )
  1762. DECLARE @EndRow int
  1763. SET @EndRow = (@Page*@PageSize) + 1
  1764. SET ROWCOUNT @EndRow
  1765. --DECLARE @NumDays INT
  1766. --SET @NumDays = 2
  1767. IF ( @Solved = 'UnSolved' )
  1768. BEGIN
  1769. IF ( @Raided = 'NotRaided' )
  1770. BEGIN
  1771. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1772. select Distinct(CD.iBucket), BucketID, FollowUp, Count(CD.iBucket) as CrashCount, BugID, SolutionID from DBGPortal_CrashData as CD
  1773. inner join DBGPortal_BucketData as BD on CD.iBucket = BD.iBucket
  1774. where DATEDIFF(day,EntryDate,GETDATE()) < @NumDays AND SolutionID IS Null and BugID is NULL
  1775. GROUP BY CD.iBucket, BucketID, FollowUp, BugID, SolutionID
  1776. ORDER BY CrashCount desc
  1777. END
  1778. IF ( @Raided = 'Raided' )
  1779. BEGIN
  1780. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1781. select Distinct(CD.iBucket), BucketID, FollowUp, Count(CD.iBucket) as CrashCount, BugID, SolutionID from DBGPortal_CrashData as CD
  1782. inner join DBGPortal_BucketData as BD on CD.iBucket = BD.iBucket
  1783. where DATEDIFF(day,EntryDate,GETDATE()) < @NumDays AND SolutionID IS Null and BugID is NOT NULL
  1784. GROUP BY CD.iBucket, BucketID, FollowUp, BugID, SolutionID
  1785. ORDER BY CrashCount desc
  1786. END
  1787. IF ( @Raided = 'All' )
  1788. BEGIN
  1789. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1790. select Distinct(CD.iBucket), BucketID, FollowUp, Count(CD.iBucket) as CrashCount, BugID, SolutionID from DBGPortal_CrashData as CD
  1791. inner join DBGPortal_BucketData as BD on CD.iBucket = BD.iBucket
  1792. where DATEDIFF(day,EntryDate,GETDATE()) < @NumDays AND SolutionID is NULL
  1793. GROUP BY CD.iBucket, BucketID, FollowUp, BugID, SolutionID
  1794. ORDER BY CrashCount desc
  1795. END
  1796. END
  1797. ELSE IF( @Solved = 'Solved' )
  1798. BEGIN
  1799. IF ( @Raided = 'Raided' )
  1800. BEGIN
  1801. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1802. select Distinct(CD.iBucket), BucketID, FollowUp, Count(CD.iBucket) as CrashCount, BugID, SolutionID from DBGPortal_CrashData as CD
  1803. inner join DBGPortal_BucketData as BD on CD.iBucket = BD.iBucket
  1804. where DATEDIFF(day,EntryDate,GETDATE()) < @NumDays AND SolutionID IS NOT Null AND BugID IS NOT NULL
  1805. GROUP BY CD.iBucket, BucketID, FollowUp, BugID, SolutionID
  1806. ORDER BY CrashCount desc
  1807. END
  1808. IF ( @Raided = 'NotRaided' )
  1809. BEGIN
  1810. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1811. select Distinct(CD.iBucket), BucketID, FollowUp, Count(CD.iBucket) as CrashCount, BugID, SolutionID from DBGPortal_CrashData as CD
  1812. inner join DBGPortal_BucketData as BD on CD.iBucket = BD.iBucket
  1813. where DATEDIFF(day,EntryDate,GETDATE()) < @NumDays AND SolutionID IS NOT Null AND BugID is NULL
  1814. GROUP BY CD.iBucket, BucketID, FollowUp, BugID, SolutionID
  1815. ORDER BY CrashCount desc
  1816. END
  1817. IF ( @Raided = 'all' )
  1818. BEGIN
  1819. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1820. select Distinct(CD.iBucket), BucketID, FollowUp, Count(CD.iBucket) as CrashCount, BugID, SolutionID from DBGPortal_CrashData as CD
  1821. inner join DBGPortal_BucketData as BD on CD.iBucket = BD.iBucket
  1822. where DATEDIFF(day,EntryDate,GETDATE()) < @NumDays AND SolutionID IS NOT Null
  1823. GROUP BY CD.iBucket, BucketID, FollowUp, BugID, SolutionID
  1824. ORDER BY CrashCount desc
  1825. END
  1826. END
  1827. ELSE IF ( @Solved = 'all' )
  1828. BEGIN
  1829. IF ( @Raided = 'NotRaided' )
  1830. BEGIN
  1831. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1832. select Distinct(CD.iBucket), BucketID, FollowUp, Count(CD.iBucket) as CrashCount, BugID, SolutionID from DBGPortal_CrashData as CD
  1833. inner join DBGPortal_BucketData as BD on CD.iBucket = BD.iBucket
  1834. where DATEDIFF(day,EntryDate,GETDATE()) < @NumDays AND BugID is NULL
  1835. GROUP BY CD.iBucket, BucketID, FollowUp, BugID, SolutionID
  1836. ORDER BY CrashCount desc
  1837. END
  1838. IF ( @Raided = 'Raided' )
  1839. BEGIN
  1840. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1841. select Distinct(CD.iBucket), BucketID, FollowUp, Count(CD.iBucket) as CrashCount, BugID, SolutionID from DBGPortal_CrashData as CD
  1842. inner join DBGPortal_BucketData as BD on CD.iBucket = BD.iBucket
  1843. where DATEDIFF(day,EntryDate,GETDATE()) < @NumDays AND BugID is NOT NULL
  1844. GROUP BY CD.iBucket, BucketID, FollowUp, BugID, SolutionID
  1845. ORDER BY CrashCount desc
  1846. END
  1847. IF ( @Raided = 'All' )
  1848. BEGIN
  1849. INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1850. select Distinct(CD.iBucket), BucketID, FollowUp, Count(CD.iBucket) as CrashCount, BugID, SolutionID from DBGPortal_CrashData as CD
  1851. inner join DBGPortal_BucketData as BD on CD.iBucket = BD.iBucket
  1852. where DATEDIFF(day,EntryDate,GETDATE()) < @NumDays
  1853. GROUP BY CD.iBucket, BucketID, FollowUp, BugID, SolutionID
  1854. ORDER BY CrashCount desc
  1855. END
  1856. -- INSERT INTO @tmpTable ( iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID )
  1857. -- select Distinct(CD.iBucket), BucketID, FollowUp, Count(CD.iBucket) as CrashCount, BugID, SolutionID from DBGPortal_CrashData as CD
  1858. -- inner join DBGPortal_BucketData as BD on CD.iBucket = BD.iBucket
  1859. -- where DATEDIFF(day,EntryDate,GETDATE()) < @NumDays
  1860. -- GROUP BY CD.iBucket, BucketID, FollowUp, BugID, SolutionID
  1861. -- ORDER BY CrashCount desc
  1862. END
  1863. select iBucket, BucketID, FollowUp, CrashCount, BugID, SolutionID from @TmpTable where Anindex>= ((@Page-1)*@PageSize+1) and AnIndex <= ((@Page) *@PageSize)
  1864. SET ROWCOUNT 0
  1865. GO
  1866. SET QUOTED_IDENTIFIER OFF
  1867. GO
  1868. SET ANSI_NULLS ON
  1869. GO
  1870. SET QUOTED_IDENTIFIER ON
  1871. GO
  1872. SET ANSI_NULLS OFF
  1873. GO
  1874. CREATE PROCEDURE "DBGP_GetBucketsBySpecificBuildNumber"(
  1875. @Build int,
  1876. @QueryType tinyint = 1
  1877. ) AS
  1878. --Unsolved buckets
  1879. IF ( @QueryType = 1 )
  1880. BEGIN
  1881. SELECT TOP 25 sBucket, BTI.BucketID, FollowUP, "Crash Count", BugID, SolutionID FROM (
  1882. SELECT sBucket, Count(sBucket) as "Crash Count"
  1883. FROM CrashInstances WHERE BuildNo = @Build
  1884. GROUP BY sBucket
  1885. ) AS One
  1886. INNER JOIN BucketToInt as BTI ON sBucket = BTI.iBucket
  1887. LEFT JOIN Solutions.dbo.SolvedBuckets on BTI.BucketID = strBucket
  1888. LEFT JOIN RaidBugs as R on BTI.iBucket=R.iBucket
  1889. INNER JOIN FollowupIDs AS F on BTI.iFollowUP = F.iFollowUP
  1890. WHERE SolutionID is NULL and BugID is Null
  1891. ORDER BY "Crash Count" DESC
  1892. END
  1893. --Raided buckets
  1894. IF( @QueryType = 2 )
  1895. BEGIN
  1896. SELECT TOP 25 Two.iBucket, BTI.BucketID, FollowUP, "Crash Count", BugID, SolutionID FROM (
  1897. SELECT TOP 100 PERCENT iBucket, BugID, Count(sBucket) as "Crash Count" FROM (SELECT iBucket, BugID FROM RaidBugs) as One
  1898. INNER JOIN CrashInstances ON iBucket = sBucket
  1899. WHERE BuildNo = @Build
  1900. GROUP BY iBucket, BugID
  1901. ORDER BY "Crash Count" DESC
  1902. ) as Two
  1903. INNER JOIN BucketToInt as BTI on BTI.iBucket = Two.iBucket
  1904. LEFT JOIN FollowupIDs as F on BTI.iFollowUP = F.iFollowUP
  1905. LEFT JOIN Solutions.DBO.SolvedBuckets on BTI.BucketID = strBucket
  1906. WHERE SolutionID is NULL
  1907. ORDER BY "Crash Count" DESC
  1908. END
  1909. --Solved Buckets
  1910. IF( @QueryType = 3 )
  1911. BEGIN
  1912. SELECT TOP 25 Two.iBucket, two.BucketID, FollowUp, Count(sBucket) as "Crash Count", BugId, SolutionID
  1913. FROM (
  1914. SELECT iBucket, BTI.BucketID, FollowUP, SolutionID
  1915. FROM (
  1916. SELECT strBucket, SolutionID
  1917. FROM Solutions.DBO.SolvedBuckets
  1918. ) as One
  1919. INNER JOIN BucketToInt as BTI ON one.StrBucket = BTI.BucketID
  1920. LEFT JOIN FollowUPIds as F ON BTI.iFollowUp = F.iFollowUP
  1921. ) as Two
  1922. INNER JOIN CrashInstances as C on Two.iBucket = sBucket
  1923. LEFT JOIN RaidBugs as R on Two.iBucket = R.iBucket
  1924. WHERE BuildNo = @Build
  1925. GROUP BY Two.iBucket, two.BucketID, FollowUp, BugID, SolutionID
  1926. ORDER BY "Crash Count" DESC
  1927. END
  1928. GO
  1929. SET QUOTED_IDENTIFIER OFF
  1930. GO
  1931. SET ANSI_NULLS ON
  1932. GO
  1933. SET QUOTED_IDENTIFIER ON
  1934. GO
  1935. SET ANSI_NULLS OFF
  1936. GO
  1937. CREATE PROCEDURE DBGP_GetCommentActions AS
  1938. SELECT * FROM CommentActions WHERE ActionID <= 5
  1939. GO
  1940. SET QUOTED_IDENTIFIER OFF
  1941. GO
  1942. SET ANSI_NULLS ON
  1943. GO
  1944. SET QUOTED_IDENTIFIER ON
  1945. GO
  1946. SET ANSI_NULLS OFF
  1947. GO
  1948. CREATE PROCEDURE DBGP_GetCommentsByBucketID(
  1949. @BucketID varchar(100)
  1950. ) AS
  1951. SELECT ActionID, EntryDate, CommentBy, [Action], Comment FROM Comments where BucketID = @BucketID ORDER BY EntryDate ASC
  1952. GO
  1953. SET QUOTED_IDENTIFIER OFF
  1954. GO
  1955. SET ANSI_NULLS ON
  1956. GO
  1957. SET QUOTED_IDENTIFIER OFF
  1958. GO
  1959. SET ANSI_NULLS OFF
  1960. GO
  1961. CREATE PROCEDURE DBGP_GetCrashInfoPerFile (
  1962. @filename varchar(100),
  1963. @Build int
  1964. ) AS
  1965. select d.Drivername, COUNT(DISTINCT iBucket) as buckets, COUNT(sBucket) as Hits from BuckettoInt as I
  1966. INNER JOIN CrashInstances as C on i.iBucket = c.sBucket
  1967. INNER JOIN DrNames as D on i.iDriverName = d.IDriverName
  1968. where d.Drivername = @Filename and BuildNo = @Build
  1969. group by d.DriverName
  1970. order by hits desc
  1971. GO
  1972. SET QUOTED_IDENTIFIER OFF
  1973. GO
  1974. SET ANSI_NULLS ON
  1975. GO
  1976. SET QUOTED_IDENTIFIER ON
  1977. GO
  1978. SET ANSI_NULLS OFF
  1979. GO
  1980. CREATE PROCEDURE DBGP_GetCustomerInfoByBucketID (
  1981. @BucketID int
  1982. ) AS
  1983. --Select top 10 Crash.Path, Inc.IncidentID, Created, Display, ComputerName, [Description], Repro, Comments, Email, Contact, Phone, Lang from
  1984. -- KaCustomer2.dbo.Incident as Inc
  1985. --inner join KaCustomer2.dbo.customer as Cust on Inc.HighId = Cust.HighID and Inc.LowId = Cust.LowID
  1986. --inner join CrashDB.dbo.CrashInstances as crash on crash.IncidentID = Inc.IncidentID
  1987. -- where sBucket=@BucketID order by [Description] desc
  1988. --GO
  1989. Select top 100 Crash.Path, BuildNo, EntryDate, Inc.IncidentID from
  1990. KaCustomer2.dbo.Incident as Inc
  1991. inner join KaCustomer2.dbo.customer as Cust on Inc.HighId = Cust.HighID and Inc.LowId = Cust.LowID
  1992. inner join CrashDB2.dbo.CrashInstances as crash on crash.IncidentID = Inc.IncidentID
  1993. where Inc.sBucket=@BucketID order by [Description] desc
  1994. GO
  1995. SET QUOTED_IDENTIFIER OFF
  1996. GO
  1997. SET ANSI_NULLS ON
  1998. GO
  1999. SET QUOTED_IDENTIFIER OFF
  2000. GO
  2001. SET ANSI_NULLS OFF
  2002. GO
  2003. CREATE PROCEDURE DBGP_GetCustomerInfoByIncident(
  2004. @IncidentID int
  2005. ) AS
  2006. --SELECT * FROM KaCustomer2.dbo.Incident where IncidentID = @IncidentID
  2007. --select Display, ComputerName, OSName, OSVersion, OSLang, Description, Repro, Comments from KaCustomer2.dbo.Incident where IncidentID = @IncidentID
  2008. select Email, Contact,Phone, Lang, Created, Display, ComputerName, OSName, OSVersion, OSLang, Description, Repro, Comments from
  2009. KaCustomer2.dbo.Incident as I
  2010. LEFT JOIN KaCustomer2.dbo.Customer as C on I.HighID=C.HighID and I.LowID=C.LowID
  2011. where IncidentID = @IncidentID
  2012. GO
  2013. SET QUOTED_IDENTIFIER OFF
  2014. GO
  2015. SET ANSI_NULLS ON
  2016. GO
  2017. SET QUOTED_IDENTIFIER ON
  2018. GO
  2019. SET ANSI_NULLS OFF
  2020. GO
  2021. CREATE PROCEDURE DBGP_GetDeliveryTypes AS
  2022. SELECT DeliveryType FROM Solutions.DBO.DeliveryTypes
  2023. GO
  2024. SET QUOTED_IDENTIFIER OFF
  2025. GO
  2026. SET ANSI_NULLS ON
  2027. GO
  2028. SET QUOTED_IDENTIFIER OFF
  2029. GO
  2030. SET ANSI_NULLS OFF
  2031. GO
  2032. CREATE PROCEDURE DBGP_GetFollowUpAliases AS
  2033. select distinct(FollowUP), FollowUp from FollowUPIds order by FollowUP ASC
  2034. GO
  2035. SET QUOTED_IDENTIFIER OFF
  2036. GO
  2037. SET ANSI_NULLS ON
  2038. GO
  2039. SET QUOTED_IDENTIFIER OFF
  2040. GO
  2041. SET ANSI_NULLS OFF
  2042. GO
  2043. CREATE PROCEDURE DBGP_GetFollowUpBucketCounts AS
  2044. SELECT FollowUp, Count(iBucket) as BucketCount FROM FollowUpIds as F
  2045. INNER JOIN BucketToInt as BTI on F.iFollowUp = BTI.iFollowUp
  2046. GROUP BY FollowUp
  2047. ORDER BY BucketCount DESC
  2048. GO
  2049. SET QUOTED_IDENTIFIER OFF
  2050. GO
  2051. SET ANSI_NULLS ON
  2052. GO
  2053. SET QUOTED_IDENTIFIER OFF
  2054. GO
  2055. SET ANSI_NULLS OFF
  2056. GO
  2057. CREATE PROCEDURE DBGP_GetPendingSolutionRequestByBucketID(
  2058. @BucketID varchar(100)
  2059. ) AS
  2060. select EntryDate, CommentBy, Comment from comments where actionID = 8 and BucketID = @BucketID
  2061. GO
  2062. SET QUOTED_IDENTIFIER OFF
  2063. GO
  2064. SET ANSI_NULLS ON
  2065. GO
  2066. SET QUOTED_IDENTIFIER OFF
  2067. GO
  2068. SET ANSI_NULLS OFF
  2069. GO
  2070. CREATE PROCEDURE DBGP_GetPendingSolutionRequests AS
  2071. select CrashCount, EntryDate, CommentBy, Comment, C.BucketID, 1 as [Create Solution] from comments as C
  2072. INNER JOIN DBGPortal_BucketData as CD on C.BucketID = CD.BucketID
  2073. where actionID = 8
  2074. order by crashcount DESC
  2075. GO
  2076. SET QUOTED_IDENTIFIER OFF
  2077. GO
  2078. SET ANSI_NULLS ON
  2079. GO
  2080. SET QUOTED_IDENTIFIER OFF
  2081. GO
  2082. SET ANSI_NULLS OFF
  2083. GO
  2084. CREATE PROCEDURE DBGP_GetSolutionTypes AS
  2085. SELECT SolutionTypeName from Solutions.DBO.SolutionTypes
  2086. GO
  2087. SET QUOTED_IDENTIFIER OFF
  2088. GO
  2089. SET ANSI_NULLS ON
  2090. GO
  2091. SET QUOTED_IDENTIFIER OFF
  2092. GO
  2093. SET ANSI_NULLS OFF
  2094. GO
  2095. CREATE PROCEDURE DBGP_GetSolvedBucketsBySpecificBuildNumber (
  2096. @Build int
  2097. ) AS
  2098. SELECT top 10 two.iBucket, BucketID, FollowUp, CrashCount FROM (
  2099. SELECT
  2100. Distinct(iBucket) as iBucket, count(iBucket) as CrashCount
  2101. FROM
  2102. BucketToCrash
  2103. INNER JOIN (
  2104. SELECT crashID from CrashInstances where BuildNo = @Build
  2105. ) as nCrashID
  2106. ON
  2107. BucketToCrash.CrashID = nCrashID.CrashID
  2108. WHERE
  2109. iBucket <> 101 and iBucket<>102
  2110. group by iBucket
  2111. ) as two
  2112. INNER JOIN
  2113. BucketToInt on two.iBucket = BucketToInt.iBucket
  2114. LEFT JOIN
  2115. Solutions.dbo.SolvedBuckets on two.iBucket=bucket
  2116. LEFT JOIN
  2117. FollowUpIds on BucketToInt.iFollowup = followUpIds.iFollowup
  2118. WHERE SolutionID is NOT null
  2119. order by CrashCount DESC
  2120. GO
  2121. SET QUOTED_IDENTIFIER OFF
  2122. GO
  2123. SET ANSI_NULLS ON
  2124. GO
  2125. SET QUOTED_IDENTIFIER ON
  2126. GO
  2127. SET ANSI_NULLS OFF
  2128. GO
  2129. CREATE PROCEDURE DBGP_GetStaticDataRowCount (
  2130. @Page int = 0, --dummy
  2131. @PageSize int =0, --dummy
  2132. @Solved varchar(20) = 'unSolved',
  2133. @Raided varchar(20) = 'unRaided',
  2134. @Reserved varchar(20) = 'Reserved', --sortorder
  2135. @Reserved2 varchar(20) = 'Reserved', --desc
  2136. @Alias varchar(20) = 'none',
  2137. @NumDays int = 0 --number of days to count
  2138. ) AS
  2139. IF ( @Alias = 'none' )
  2140. BEGIN
  2141. IF ( @NumDays = 0 )
  2142. BEGIN
  2143. IF ( @Solved = 'solved' )
  2144. BEGIN
  2145. IF ( @Raided = 'Raided' )
  2146. SELECT COUNT(*) as NumRows FROM DBGPortal_BucketData WHERE SolutionID is NOT null and BugID is NOT NULL
  2147. ELSE IF ( @Raided = 'notRaided' )
  2148. SELECT COUNT(*) as NumRows FROM DBGPortal_BucketData WHERE SolutionID is NOT null and BugID is NULL
  2149. ELSE IF ( @Raided = 'all' )
  2150. SELECT COUNT(*) as NumRows FROM DBGPortal_BucketData WHERE SolutionID is NOT null --and BugID is NULL
  2151. --select COUNt(DISTINCT(CD.iBucket)) as NumRows from DBGPortal_CrashData as CD
  2152. -- inner join DBGPortal_BucketData as BD on CD.iBucket = BD.iBucket
  2153. -- where DATEDIFF(day,EntryDate,GETDATE()) < @NumDays AND SolutionID IS NOT NULL
  2154. END
  2155. ELSE IF ( @Solved = 'unsolved' )
  2156. BEGIN
  2157. IF ( @Raided = 'Raided' )
  2158. SELECT COUNT(*) as NumRows FROM DBGPortal_BucketData WHERE SolutionID is null and BugID is NOT NULL
  2159. ELSE IF ( @Raided = 'NotRaided' )
  2160. SELECT COUNT(*) as NumRows FROM DBGPortal_BucketData WHERE SolutionID is null and BugID is NULL
  2161. ELSE IF ( @Raided = 'all' )
  2162. SELECT COUNT(*) as NumRows FROM DBGPortal_BucketData WHERE SolutionID is null
  2163. -- select COUNt(DISTINCT(CD.iBucket)) as NumRows from DBGPortal_CrashData as CD
  2164. -- inner join DBGPortal_BucketData as BD on CD.iBucket = BD.iBucket
  2165. -- where DATEDIFF(day,EntryDate,GETDATE()) < @NumDays AND SolutionID IS NULL
  2166. END
  2167. ELSE IF ( @Solved = 'all' )
  2168. BEGIN
  2169. IF ( @Raided = 'Raided' )
  2170. SELECT COUNT(*) as NumRows FROM DBGPortal_BucketData WHERE BugID is NOT NULL
  2171. ELSE IF ( @Raided = 'NotRaided' )
  2172. SELECT COUNT(*) as NumRows FROM DBGPortal_BucketData WHERE BugID is NULL
  2173. ELSE IF ( @Raided = 'all' )
  2174. SELECT COUNT(*) as NumRows FROM DBGPortal_BucketData
  2175. END
  2176. END
  2177. ELSE
  2178. BEGIN
  2179. IF( @Solved = 'solved' )
  2180. BEGIN
  2181. IF ( @Raided = 'Raided' )
  2182. select COUNt(DISTINCT(CD.iBucket)) as NumRows from DBGPortal_CrashData as CD
  2183. inner join DBGPortal_BucketData as BD on CD.iBucket = BD.iBucket
  2184. where DATEDIFF(day,EntryDate,GETDATE()) < @NumDays and SolutionID IS NOT NULL AND BugID is NOT NULL
  2185. ELSE IF ( @Raided = 'NotRaided' )
  2186. select COUNt(DISTINCT(CD.iBucket)) as NumRows from DBGPortal_CrashData as CD
  2187. inner join DBGPortal_BucketData as BD on CD.iBucket = BD.iBucket
  2188. where DATEDIFF(day,EntryDate,GETDATE()) < @NumDays AND SolutionID IS NOT NULL AND BugID is NULL
  2189. ELSE IF ( @Raided = 'all' )
  2190. select COUNt(DISTINCT(CD.iBucket)) as NumRows from DBGPortal_CrashData as CD
  2191. inner join DBGPortal_BucketData as BD on CD.iBucket = BD.iBucket
  2192. where DATEDIFF(day,EntryDate,GETDATE()) < @NumDays AND SolutionID IS NOT NULL
  2193. END
  2194. ELSE IF ( @Solved = 'unsolved' )
  2195. BEGIN
  2196. IF ( @Raided = 'Raided' )
  2197. select COUNt(DISTINCT(CD.iBucket)) as NumRows from DBGPortal_CrashData as CD
  2198. inner join DBGPortal_BucketData as BD on CD.iBucket = BD.iBucket
  2199. where DATEDIFF(day,EntryDate,GETDATE()) < @NumDays and SolutionID IS NULL AND BugID is NOT NULL
  2200. ELSE IF ( @Raided = 'NotRaided' )
  2201. select COUNt(DISTINCT(CD.iBucket)) as NumRows from DBGPortal_CrashData as CD
  2202. inner join DBGPortal_BucketData as BD on CD.iBucket = BD.iBucket
  2203. where DATEDIFF(day,EntryDate,GETDATE()) < @NumDays AND SolutionID IS NULL AND BugID is NULL
  2204. ELSE IF ( @Raided = 'all' )
  2205. select COUNt(DISTINCT(CD.iBucket)) as NumRows from DBGPortal_CrashData as CD
  2206. inner join DBGPortal_BucketData as BD on CD.iBucket = BD.iBucket
  2207. where DATEDIFF(day,EntryDate,GETDATE()) < @NumDays and SolutionID IS NULL
  2208. END
  2209. ELSE IF ( @Solved= 'all' )
  2210. BEGIN
  2211. IF ( @Raided = 'Raided' )
  2212. select COUNt(DISTINCT(CD.iBucket)) as NumRows from DBGPortal_CrashData as CD
  2213. inner join DBGPortal_BucketData as BD on CD.iBucket = BD.iBucket
  2214. where DATEDIFF(day,EntryDate,GETDATE()) < @NumDays and BugID is NOT NULL
  2215. ELSE IF ( @Raided = 'NotRaided' )
  2216. select COUNt(DISTINCT(CD.iBucket)) as NumRows from DBGPortal_CrashData as CD
  2217. inner join DBGPortal_BucketData as BD on CD.iBucket = BD.iBucket
  2218. where DATEDIFF(day,EntryDate,GETDATE()) < @NumDays AND BugID is NULL
  2219. ELSE IF ( @Raided = 'all' )
  2220. select COUNt(DISTINCT(CD.iBucket)) as NumRows from DBGPortal_CrashData as CD
  2221. where DATEDIFF(day,EntryDate,GETDATE()) < @NumDays
  2222. END
  2223. END
  2224. END
  2225. ELSE
  2226. BEGIN
  2227. IF ( @Solved = 'solved' )
  2228. BEGIN
  2229. IF ( @Raided = 'Raided' )
  2230. SELECT COUNT(*) as NumRows FROM DBGPortal_BucketData WHERE SolutionID is NOT null and BugID is NOT NULL AND FollowUp = @Alias
  2231. ELSE IF ( @Raided = 'NotRaided' )
  2232. SELECT COUNT(*) as NumRows FROM DBGPortal_BucketData WHERE SolutionID is NOT null AND FollowUp = @Alias and BugID is NULL
  2233. ELSE IF ( @Raided = 'All' )
  2234. SELECT COUNT(*) as NumRows FROM DBGPortal_BucketData WHERE SolutionID is NOT null AND FollowUp = @Alias
  2235. END
  2236. ELSE IF ( @Solved = 'unSolved' )
  2237. BEGIN
  2238. IF ( @Raided = 'Raided' )
  2239. SELECT COUNT(*) as NumRows FROM DBGPortal_BucketData WHERE SolutionID is null and BugID is NOT NULL AND FollowUp = @Alias
  2240. ELSE IF ( @Raided = 'notRaided' )
  2241. SELECT COUNT(*) as NumRows FROM DBGPortal_BucketData WHERE SolutionID is null and BugID is NULL AND FollowUp = @Alias
  2242. ELSE IF ( @Raided = 'All' )
  2243. SELECT COUNT(*) as NumRows FROM DBGPortal_BucketData WHERE SolutionID is NULL and FollowUp = @Alias
  2244. END
  2245. ELSE IF ( @Solved = 'all' )
  2246. BEGIN
  2247. IF ( @Raided = 'Raided' )
  2248. SELECT COUNT(*) as NumRows FROM DBGPortal_BucketData WHERE BugID is NOT NULL AND FollowUp = @Alias
  2249. ELSE IF ( @Raided = 'notRaided' )
  2250. SELECT COUNT(*) as NumRows FROM DBGPortal_BucketData WHERE BugID is NULL AND FollowUp = @Alias
  2251. ELSE IF ( @Raided = 'All' )
  2252. SELECT COUNT(*) as NumRows FROM DBGPortal_BucketData WHERE FollowUp = @Alias
  2253. END
  2254. END
  2255. GO
  2256. SET QUOTED_IDENTIFIER OFF
  2257. GO
  2258. SET ANSI_NULLS ON
  2259. GO
  2260. SET QUOTED_IDENTIFIER ON
  2261. GO
  2262. SET ANSI_NULLS OFF
  2263. GO
  2264. CREATE PROCEDURE DBGP_GetTopUnsolvedBuckets AS
  2265. SELECT TOP 25 BTI.iBucket, BTI.BucketID, FollowUP, [Crash Count], BugID, SolutionID FROM
  2266. (SELECT TOP 100 PERCENT sBucket, Count(sBucket) as [Crash Count] FROM CrashInstances
  2267. group by sBucket
  2268. ORDER by [Crash Count] DESC ) as One
  2269. INNER JOIN BucketToInt as BTI on sBucket=BTI.iBucket
  2270. INNER JOIN FollowUPIDs as F on BTI.iFollowUP = F.iFollowup
  2271. LEFT JOIN Solutions.dbo.SolvedBuckets as SOL on BucketID = SOL.strbucket
  2272. LEFT JOIN RaidBugs as R on BTI.iBucket = R.iBucket
  2273. WHERE BugID is NULL and SolutionID is NULL
  2274. order by [Crash Count] DESC
  2275. GO
  2276. SET QUOTED_IDENTIFIER OFF
  2277. GO
  2278. SET ANSI_NULLS ON
  2279. GO
  2280. SET QUOTED_IDENTIFIER OFF
  2281. GO
  2282. SET ANSI_NULLS OFF
  2283. GO
  2284. CREATE PROCEDURE DBGP_GetUnsolvedBucketsBySpecificBuildNumber (
  2285. @Build int
  2286. ) AS
  2287. SELECT top 10 two.iBucket, BucketID, FollowUp, CrashCount FROM (
  2288. SELECT
  2289. Distinct(iBucket) as iBucket, count(iBucket) as CrashCount
  2290. FROM
  2291. BucketToCrash
  2292. INNER JOIN (
  2293. SELECT crashID from CrashInstances where BuildNo = @Build
  2294. ) as nCrashID
  2295. ON
  2296. BucketToCrash.CrashID = nCrashID.CrashID
  2297. WHERE
  2298. iBucket <> 101 and iBucket<>102
  2299. group by iBucket
  2300. ) as two
  2301. INNER JOIN
  2302. BucketToInt on two.iBucket = BucketToInt.iBucket
  2303. LEFT JOIN
  2304. Solutions.dbo.SolvedBuckets on two.iBucket=bucket
  2305. LEFT JOIN
  2306. FollowUpids on BucketToInt.iFollowup = followUpids.iFollowup
  2307. WHERE SolutionID is null
  2308. order by CrashCount DESC
  2309. GO
  2310. SET QUOTED_IDENTIFIER OFF
  2311. GO
  2312. SET ANSI_NULLS ON
  2313. GO
  2314. SET QUOTED_IDENTIFIER OFF
  2315. GO
  2316. SET ANSI_NULLS OFF
  2317. GO
  2318. CREATE PROCEDURE DBGP_GetibucketByBucketID(
  2319. @BucketID Varchar(100)
  2320. ) AS
  2321. SELECT iBucket FROM BucketToInt where BucketID = @BucketID
  2322. GO
  2323. SET QUOTED_IDENTIFIER OFF
  2324. GO
  2325. SET ANSI_NULLS ON
  2326. GO
  2327. SET QUOTED_IDENTIFIER ON
  2328. GO
  2329. SET ANSI_NULLS OFF
  2330. GO
  2331. CREATE PROCEDURE DBGP_SetBucketBugNumber (
  2332. @BucketID varchar(100),
  2333. @BugID int,
  2334. @iBucket int,
  2335. @Area varchar(30)
  2336. ) AS
  2337. IF EXISTS( SELECT iBucket FROM RaidBugs WHERE BucketID = @BucketID )
  2338. UPDATE RaidBugs SET BugID=@BugID, Area=@Area WHERE BucketID = @BucketID
  2339. ELSE
  2340. INSERT INTO RaidBugs (iBucket, BugID, BucketID, Area ) VALUES ( @iBucket, @BugID, @BucketID, @Area )
  2341. GO
  2342. SET QUOTED_IDENTIFIER OFF
  2343. GO
  2344. SET ANSI_NULLS ON
  2345. GO
  2346. SET QUOTED_IDENTIFIER ON
  2347. GO
  2348. SET ANSI_NULLS OFF
  2349. GO
  2350. CREATE PROCEDURE DBGP_SetComment(
  2351. @By varchar(20),
  2352. -- @Action nvarchar(50),
  2353. @Action int,
  2354. @Comment nvarchar(1000),
  2355. @BucketID varchar(100),
  2356. @iBucket int
  2357. ) AS
  2358. DECLARE @ActionString nvarchar(50)
  2359. IF ( @Action = 7 )
  2360. UPDATE Comments SET ActionID = 6, Action=(SELECT [Action] FROM CommentActions WHERE ActionID = 6) WHERE BucketID=@BucketID and ActionID = 8
  2361. if ( @Action = 9 )
  2362. UPDATE Comments SET ActionID = 10, Action=(SELECT [Action] FROM CommentActions WHERE ActionID = 10) WHERE BucketID=@BucketID and ActionID = 8
  2363. SELECT @ActionString = [Action] from CommentActions where ActionID = @Action
  2364. INSERT INTO Comments ( EntryDate, CommentBy, [Action], Comment, BucketID, ActionID, iBucket ) VALUES ( GETDATE(), @By, @ActionString, @Comment, @BucketID, @Action, @iBucket )
  2365. GO
  2366. SET QUOTED_IDENTIFIER OFF
  2367. GO
  2368. SET ANSI_NULLS ON
  2369. GO
  2370. SET QUOTED_IDENTIFIER ON
  2371. GO
  2372. SET ANSI_NULLS OFF
  2373. GO
  2374. CREATE PROCEDURE DBGP_UpdateCrashData AS
  2375. DECLARE @LastUpdate datetime
  2376. select top 1 @LastUpdate = EntryDate from DBGPortal_Crashdata order by EntryDate DESC
  2377. PRINT @LastUpdate
  2378. INSERT INTO dbgportal_CrashData (Path, BuildNo, EntryDate, IncidentID, email, Description, Comments, Repro, iBucket, TrackID )
  2379. select Crash.Path, BuildNo, EntryDate, Inc.IncidentID, Email, Description, Comments, Repro, Crash.sBucket, trackID from CrashInstances as Crash
  2380. left join KaCustomer2.dbo.Incident as Inc on Crash.IncidentID=Inc.IncidentID
  2381. left join KaCustomer2.dbo.customer as Cust on Inc.HighId = Cust.HighID and Inc.LowId = Cust.LowID
  2382. WHERE EntryDate > @LastUpdate
  2383. GO
  2384. SET QUOTED_IDENTIFIER OFF
  2385. GO
  2386. SET ANSI_NULLS ON
  2387. GO
  2388. SET QUOTED_IDENTIFIER ON
  2389. GO
  2390. SET ANSI_NULLS OFF
  2391. GO
  2392. CREATE PROCEDURE DBGP_UpdateStaticDataBugID (
  2393. @BucketID varchar(100),
  2394. @BugID int
  2395. ) AS
  2396. UPDATE DBGPortal_BucketData SET BugID = @BugID WHERE BucketID = @BucketID
  2397. GO
  2398. SET QUOTED_IDENTIFIER OFF
  2399. GO
  2400. SET ANSI_NULLS ON
  2401. GO
  2402. SET QUOTED_IDENTIFIER ON
  2403. GO
  2404. SET ANSI_NULLS OFF
  2405. GO
  2406. CREATE PROCEDURE DBGP_UpdateStaticDataSolutionID(
  2407. @BucketID varchar(100),
  2408. @SolutionID int
  2409. ) AS
  2410. UPDATE DBGPortal_BucketData SET SolutionID = @SolutionID WHERE BucketID = @BucketID
  2411. GO
  2412. SET QUOTED_IDENTIFIER OFF
  2413. GO
  2414. SET ANSI_NULLS ON
  2415. GO
  2416. SET QUOTED_IDENTIFIER ON
  2417. GO
  2418. SET ANSI_NULLS ON
  2419. GO
  2420. CREATE PROCEDURE "SEP_CountTotalBuckets" AS
  2421. SELECT COUNT(*) as TotalBuckets FROM BucketToInt
  2422. GO
  2423. SET QUOTED_IDENTIFIER OFF
  2424. GO
  2425. SET ANSI_NULLS ON
  2426. GO
  2427. SET QUOTED_IDENTIFIER ON
  2428. GO
  2429. SET ANSI_NULLS ON
  2430. GO
  2431. CREATE PROCEDURE "SEP_GetBucketBugID"(
  2432. @iBucket int
  2433. ) AS
  2434. SELECT BugID FROM RaidBugs where iBucket = @iBucket
  2435. GO
  2436. SET QUOTED_IDENTIFIER OFF
  2437. GO
  2438. SET ANSI_NULLS ON
  2439. GO
  2440. SET QUOTED_IDENTIFIER ON
  2441. GO
  2442. SET ANSI_NULLS ON
  2443. GO
  2444. CREATE PROCEDURE "SEP_GetBucketList" AS
  2445. SELECT iBucket, BucketId FROM BucketToInt
  2446. GO
  2447. SET QUOTED_IDENTIFIER OFF
  2448. GO
  2449. SET ANSI_NULLS ON
  2450. GO
  2451. SET QUOTED_IDENTIFIER ON
  2452. GO
  2453. SET ANSI_NULLS ON
  2454. GO
  2455. CREATE PROCEDURE "SEP_GetBucketListRange"(
  2456. @Start as int,
  2457. @Size as int
  2458. ) AS
  2459. SELECT iBucket, BucketId FROM BucketToInt where iBucket >= @Start and iBucket <= (@Start + @Size) order by iBucket
  2460. GO
  2461. SET QUOTED_IDENTIFIER OFF
  2462. GO
  2463. SET ANSI_NULLS ON
  2464. GO
  2465. SET QUOTED_IDENTIFIER ON
  2466. GO
  2467. SET ANSI_NULLS ON
  2468. GO
  2469. CREATE PROCEDURE "SEP_GetBucketNameByiBucket"
  2470. (
  2471. @iBucket int
  2472. ) AS
  2473. SELECT BucketID FROM BucketToInt WHERE iBucket = @iBucket
  2474. GO
  2475. SET QUOTED_IDENTIFIER OFF
  2476. GO
  2477. SET ANSI_NULLS ON
  2478. GO