DELETE FROM [dbo].[Client] WHERE (([ResourceId] = @Original_ResourceId) AND ((@IsNull_CPUSpeed = 1 AND [CPUSpeed] IS NULL) OR ([CPUSpeed] = @Original_CPUSpeed)) AND ((@IsNull_Memory = 1 AND [Memory] IS NULL) OR ([Memory] = @Original_Memory)) AND ((@IsNull_Login = 1 AND [Login] IS NULL) OR ([Login] = @Original_Login)) AND ((@IsNull_Status = 1 AND [Status] IS NULL) OR ([Status] = @Original_Status)) AND ((@IsNull_ClientConfigId = 1 AND [ClientConfigId] IS NULL) OR ([ClientConfigId] = @Original_ClientConfigId)) AND ((@IsNull_NumberOfCores = 1 AND [NumberOfCores] IS NULL) OR ([NumberOfCores] = @Original_NumberOfCores)) AND ((@IsNull_NumberOfFreeCores = 1 AND [NumberOfFreeCores] IS NULL) OR ([NumberOfFreeCores] = @Original_NumberOfFreeCores)) AND ((@IsNull_FreeMemory = 1 AND [FreeMemory] IS NULL) OR ([FreeMemory] = @Original_FreeMemory))) INSERT INTO [dbo].[Client] ([ResourceId], [CPUSpeed], [Memory], [Login], [Status], [ClientConfigId], [NumberOfCores], [NumberOfFreeCores], [FreeMemory]) VALUES (@ResourceId, @CPUSpeed, @Memory, @Login, @Status, @ClientConfigId, @NumberOfCores, @NumberOfFreeCores, @FreeMemory); SELECT ResourceId, CPUSpeed, Memory, Login, Status, ClientConfigId, NumberOfCores, NumberOfFreeCores, FreeMemory FROM Client WHERE (ResourceId = @ResourceId) SELECT * FROM dbo.Client UPDATE [dbo].[Client] SET [ResourceId] = @ResourceId, [CPUSpeed] = @CPUSpeed, [Memory] = @Memory, [Login] = @Login, [Status] = @Status, [ClientConfigId] = @ClientConfigId, [NumberOfCores] = @NumberOfCores, [NumberOfFreeCores] = @NumberOfFreeCores, [FreeMemory] = @FreeMemory WHERE (([ResourceId] = @Original_ResourceId) AND ((@IsNull_CPUSpeed = 1 AND [CPUSpeed] IS NULL) OR ([CPUSpeed] = @Original_CPUSpeed)) AND ((@IsNull_Memory = 1 AND [Memory] IS NULL) OR ([Memory] = @Original_Memory)) AND ((@IsNull_Login = 1 AND [Login] IS NULL) OR ([Login] = @Original_Login)) AND ((@IsNull_Status = 1 AND [Status] IS NULL) OR ([Status] = @Original_Status)) AND ((@IsNull_ClientConfigId = 1 AND [ClientConfigId] IS NULL) OR ([ClientConfigId] = @Original_ClientConfigId)) AND ((@IsNull_NumberOfCores = 1 AND [NumberOfCores] IS NULL) OR ([NumberOfCores] = @Original_NumberOfCores)) AND ((@IsNull_NumberOfFreeCores = 1 AND [NumberOfFreeCores] IS NULL) OR ([NumberOfFreeCores] = @Original_NumberOfFreeCores)) AND ((@IsNull_FreeMemory = 1 AND [FreeMemory] IS NULL) OR ([FreeMemory] = @Original_FreeMemory))); SELECT ResourceId, CPUSpeed, Memory, Login, Status, ClientConfigId, NumberOfCores, NumberOfFreeCores, FreeMemory FROM Client WHERE (ResourceId = @ResourceId) SELECT CPUSpeed, ClientConfigId, FreeMemory, Login, Memory, NumberOfCores, NumberOfFreeCores, ResourceId, Status FROM Client WHERE (Status <> 'offline') SELECT CPUSpeed, ClientConfigId, FreeMemory, Login, Memory, NumberOfCores, NumberOfFreeCores, ResourceId, Status FROM Client WHERE (ResourceId = @Id) DELETE FROM [dbo].[Resource] WHERE (([ResourceId] = @Original_ResourceId) AND ((@IsNull_Name = 1 AND [Name] IS NULL) OR ([Name] = @Original_Name))) INSERT INTO [dbo].[Resource] ([ResourceId], [Name]) VALUES (@ResourceId, @Name); SELECT ResourceId, Name FROM Resource WHERE (ResourceId = @ResourceId) SELECT * FROM dbo.Resource UPDATE [dbo].[Resource] SET [ResourceId] = @ResourceId, [Name] = @Name WHERE (([ResourceId] = @Original_ResourceId) AND ((@IsNull_Name = 1 AND [Name] IS NULL) OR ([Name] = @Original_Name))); SELECT ResourceId, Name FROM Resource WHERE (ResourceId = @ResourceId) SELECT Resource.* FROM Resource INNER JOIN Client ON Resource.ResourceId = Client.ResourceId WHERE Client.Status <> 'offline' SELECT * FROM dbo.Resource WHERE ResourceId = @ID SELECT * FROM dbo.Resource WHERE Name = @Name DELETE FROM [dbo].[ClientGroup] WHERE (([ResourceId] = @Original_ResourceId)) INSERT INTO [dbo].[ClientGroup] ([ResourceId]) VALUES (@ResourceId); SELECT ResourceId FROM ClientGroup WHERE (ResourceId = @ResourceId) SELECT * FROM dbo.ClientGroup UPDATE [dbo].[ClientGroup] SET [ResourceId] = @ResourceId WHERE (([ResourceId] = @Original_ResourceId)); SELECT ResourceId FROM ClientGroup WHERE (ResourceId = @ResourceId) SELECT * FROM dbo.ClientGroup WHERE ResourceId = @Id DELETE FROM [dbo].[ClientGroup_Resource] WHERE (([ClientGroupId] = @Original_ClientGroupId) AND ([ResourceId] = @Original_ResourceId)) INSERT INTO [dbo].[ClientGroup_Resource] ([ClientGroupId], [ResourceId]) VALUES (@ClientGroupId, @ResourceId); SELECT ClientGroupId, ResourceId FROM ClientGroup_Resource WHERE (ClientGroupId = @ClientGroupId) AND (ResourceId = @ResourceId) SELECT * FROM dbo.ClientGroup_Resource UPDATE [dbo].[ClientGroup_Resource] SET [ClientGroupId] = @ClientGroupId, [ResourceId] = @ResourceId WHERE (([ClientGroupId] = @Original_ClientGroupId) AND ([ResourceId] = @Original_ResourceId)); SELECT ClientGroupId, ResourceId FROM ClientGroup_Resource WHERE (ClientGroupId = @ClientGroupId) AND (ResourceId = @ResourceId) SELECT ClientGroupId, ResourceId FROM ClientGroup_Resource WHERE (ClientGroupId = @Id) SELECT ClientGroupId, ResourceId FROM ClientGroup_Resource WHERE (ClientGroupId = @ClientGroupId) AND (ResourceId = @ResourceId) SELECT ClientGroupId, ResourceId FROM ClientGroup_Resource WHERE (ResourceId = @ResourceId) DELETE FROM [dbo].[Job] WHERE (([JobId] = @Original_JobId) AND ((@IsNull_ParentJobId = 1 AND [ParentJobId] IS NULL) OR ([ParentJobId] = @Original_ParentJobId)) AND ((@IsNull_JobState = 1 AND [JobState] IS NULL) OR ([JobState] = @Original_JobState)) AND ((@IsNull_ResourceId = 1 AND [ResourceId] IS NULL) OR ([ResourceId] = @Original_ResourceId)) AND ((@IsNull_Percentage = 1 AND [Percentage] IS NULL) OR ([Percentage] = @Original_Percentage)) AND ((@IsNull_DateCreated = 1 AND [DateCreated] IS NULL) OR ([DateCreated] = @Original_DateCreated)) AND ((@IsNull_DateCalculated = 1 AND [DateCalculated] IS NULL) OR ([DateCalculated] = @Original_DateCalculated)) AND ((@IsNull_Priority = 1 AND [Priority] IS NULL) OR ([Priority] = @Original_Priority)) AND ((@IsNull_ProjectId = 1 AND [ProjectId] IS NULL) OR ([ProjectId] = @Original_ProjectId)) AND ((@IsNull_UserId = 1 AND [UserId] IS NULL) OR ([UserId] = @Original_UserId)) AND ((@IsNull_CoresNeeded = 1 AND [CoresNeeded] IS NULL) OR ([CoresNeeded] = @Original_CoresNeeded)) AND ((@IsNull_MemoryNeeded = 1 AND [MemoryNeeded] IS NULL) OR ([MemoryNeeded] = @Original_MemoryNeeded))) INSERT INTO [dbo].[Job] ([JobId], [ParentJobId], [JobState], [ResourceId], [Percentage], [SerializedJob], [DateCreated], [DateCalculated], [Priority], [ProjectId], [UserId], [CoresNeeded], [MemoryNeeded]) VALUES (@JobId, @ParentJobId, @JobState, @ResourceId, @Percentage, @SerializedJob, @DateCreated, @DateCalculated, @Priority, @ProjectId, @UserId, @CoresNeeded, @MemoryNeeded); SELECT JobId, ParentJobId, JobState, ResourceId, Percentage, SerializedJob, DateCreated, DateCalculated, Priority, ProjectId, UserId, CoresNeeded, MemoryNeeded FROM Job WHERE (JobId = @JobId) SELECT * FROM dbo.Job WHERE JobState = @State AND CoresNeeded <= @CoresNeeded AND MemoryNeeded <= @MemoryNeeded UPDATE [dbo].[Job] SET [JobId] = @JobId, [ParentJobId] = @ParentJobId, [JobState] = @JobState, [ResourceId] = @ResourceId, [Percentage] = @Percentage, [SerializedJob] = @SerializedJob, [DateCreated] = @DateCreated, [DateCalculated] = @DateCalculated, [Priority] = @Priority, [ProjectId] = @ProjectId, [UserId] = @UserId, [CoresNeeded] = @CoresNeeded, [MemoryNeeded] = @MemoryNeeded WHERE (([JobId] = @Original_JobId) AND ((@IsNull_ParentJobId = 1 AND [ParentJobId] IS NULL) OR ([ParentJobId] = @Original_ParentJobId)) AND ((@IsNull_JobState = 1 AND [JobState] IS NULL) OR ([JobState] = @Original_JobState)) AND ((@IsNull_ResourceId = 1 AND [ResourceId] IS NULL) OR ([ResourceId] = @Original_ResourceId)) AND ((@IsNull_Percentage = 1 AND [Percentage] IS NULL) OR ([Percentage] = @Original_Percentage)) AND ((@IsNull_DateCreated = 1 AND [DateCreated] IS NULL) OR ([DateCreated] = @Original_DateCreated)) AND ((@IsNull_DateCalculated = 1 AND [DateCalculated] IS NULL) OR ([DateCalculated] = @Original_DateCalculated)) AND ((@IsNull_Priority = 1 AND [Priority] IS NULL) OR ([Priority] = @Original_Priority)) AND ((@IsNull_ProjectId = 1 AND [ProjectId] IS NULL) OR ([ProjectId] = @Original_ProjectId)) AND ((@IsNull_UserId = 1 AND [UserId] IS NULL) OR ([UserId] = @Original_UserId)) AND ((@IsNull_CoresNeeded = 1 AND [CoresNeeded] IS NULL) OR ([CoresNeeded] = @Original_CoresNeeded)) AND ((@IsNull_MemoryNeeded = 1 AND [MemoryNeeded] IS NULL) OR ([MemoryNeeded] = @Original_MemoryNeeded))); SELECT JobId, ParentJobId, JobState, ResourceId, Percentage, SerializedJob, DateCreated, DateCalculated, Priority, ProjectId, UserId, CoresNeeded, MemoryNeeded FROM Job WHERE (JobId = @JobId) SELECT * FROM dbo.Job SELECT CoresNeeded, DateCalculated, DateCreated, JobId, JobState, MemoryNeeded, ParentJobId, Percentage, Priority, ProjectId, ResourceId, SerializedJob, UserId FROM Job WHERE (JobState = 'calculating') OR (JobState = 'idle') SELECT CoresNeeded, DateCalculated, DateCreated, JobId, JobState, MemoryNeeded, ParentJobId, Percentage, Priority, ProjectId, ResourceId, SerializedJob, UserId FROM Job WHERE (JobState = 'calculating') AND (ResourceId = @ResourceId) SELECT CoresNeeded, DateCalculated, DateCreated, JobId, JobState, MemoryNeeded, ParentJobId, Percentage, Priority, ProjectId, ResourceId, SerializedJob, UserId FROM Job WHERE (ResourceId = @ResourceId) SELECT CoresNeeded, DateCalculated, DateCreated, JobId, JobState, MemoryNeeded, ParentJobId, Percentage, Priority, ProjectId, ResourceId, SerializedJob, UserId FROM Job WHERE (JobId = @Id) SELECT CoresNeeded, DateCalculated, DateCreated, JobId, JobState, MemoryNeeded, ParentJobId, Percentage, Priority, ProjectId, ResourceId, SerializedJob, UserId FROM Job WHERE (JobId = @Id) SELECT CoresNeeded, DateCalculated, DateCreated, JobId, JobState, MemoryNeeded, ParentJobId, Percentage, Priority, ProjectId, ResourceId, SerializedJob, UserId FROM Job WHERE (ParentJobId = @Id) SELECT CoresNeeded, DateCalculated, DateCreated, JobId, JobState, MemoryNeeded, ParentJobId, Percentage, Priority, ProjectId, ResourceId, SerializedJob, UserId FROM Job WHERE (JobState = @State) SELECT CoresNeeded, DateCalculated, DateCreated, JobId, JobState, MemoryNeeded, ParentJobId, Percentage, Priority, ProjectId, ResourceId, SerializedJob, UserId FROM Job WHERE (UserId = @UserId) DELETE FROM [dbo].[JobResult] WHERE (([JobResultId] = @Original_JobResultId) AND ((@IsNull_JobId = 1 AND [JobId] IS NULL) OR ([JobId] = @Original_JobId)) AND ((@IsNull_Percentage = 1 AND [Percentage] IS NULL) OR ([Percentage] = @Original_Percentage)) AND ((@IsNull_ResourceId = 1 AND [ResourceId] IS NULL) OR ([ResourceId] = @Original_ResourceId)) AND ((@IsNull_DateFinished = 1 AND [DateFinished] IS NULL) OR ([DateFinished] = @Original_DateFinished))) INSERT INTO [dbo].[JobResult] ([JobResultId], [JobId], [JobResult], [Message], [Percentage], [ResourceId], [DateFinished]) VALUES (@JobResultId, @JobId, @JobResult, @Message, @Percentage, @ResourceId, @DateFinished); SELECT JobResultId, JobId, JobResult, Message, Percentage, ResourceId, DateFinished FROM JobResult WHERE (JobResultId = @JobResultId) SELECT * FROM dbo.JobResult UPDATE [dbo].[JobResult] SET [JobResultId] = @JobResultId, [JobId] = @JobId, [JobResult] = @JobResult, [Message] = @Message, [Percentage] = @Percentage, [ResourceId] = @ResourceId, [DateFinished] = @DateFinished WHERE (([JobResultId] = @Original_JobResultId) AND ((@IsNull_JobId = 1 AND [JobId] IS NULL) OR ([JobId] = @Original_JobId)) AND ((@IsNull_Percentage = 1 AND [Percentage] IS NULL) OR ([Percentage] = @Original_Percentage)) AND ((@IsNull_ResourceId = 1 AND [ResourceId] IS NULL) OR ([ResourceId] = @Original_ResourceId)) AND ((@IsNull_DateFinished = 1 AND [DateFinished] IS NULL) OR ([DateFinished] = @Original_DateFinished))); SELECT JobResultId, JobId, JobResult, Message, Percentage, ResourceId, DateFinished FROM JobResult WHERE (JobResultId = @JobResultId) SELECT * FROM dbo.JobResult WHERE JobResultId = @Id SELECT * FROM dbo.JobResult WHERE JobId = @JobId DELETE FROM [dbo].[RequiredPlugins] WHERE (([JobId] = @Original_JobId) AND ([PluginId] = @Original_PluginId)) INSERT INTO [dbo].[RequiredPlugins] ([JobId], [PluginId]) VALUES (@JobId, @PluginId); SELECT JobId, PluginId FROM RequiredPlugins WHERE (JobId = @JobId) AND (PluginId = @PluginId) SELECT JobId, PluginId FROM dbo.RequiredPlugins UPDATE [dbo].[RequiredPlugins] SET [JobId] = @JobId, [PluginId] = @PluginId WHERE (([JobId] = @Original_JobId) AND ([PluginId] = @Original_PluginId)); SELECT JobId, PluginId FROM RequiredPlugins WHERE (JobId = @JobId) AND (PluginId = @PluginId) DELETE FROM [dbo].[PluginInfo] WHERE (([PluginId] = @Original_PluginId)) INSERT INTO [dbo].[PluginInfo] ([PluginId], [SerializedInfo]) VALUES (@PluginId, @SerializedInfo); SELECT PluginId, SerializedInfo FROM PluginInfo WHERE (PluginId = @PluginId) SELECT * FROM dbo.PluginInfo UPDATE [dbo].[PluginInfo] SET [PluginId] = @PluginId, [SerializedInfo] = @SerializedInfo WHERE (([PluginId] = @Original_PluginId)); SELECT PluginId, SerializedInfo FROM PluginInfo WHERE (PluginId = @PluginId)