Files
DP44/DataPRO_sql/dbo.sp_TestSetupsInsert.StoredProcedure.sql

271 lines
14 KiB
MySQL
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
<EFBFBD><EFBFBD>IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_TestSetupsInsert]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[sp_TestSetupsInsert]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_TestSetupsInsert]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[sp_TestSetupsInsert] AS'
END
GO
ALTER PROCEDURE [dbo].[sp_TestSetupsInsert]
@TestSetupName nvarchar(50) = Null
,@SetupDescription nvarchar(50)
,@AutomaticTestProgression bit
,@AutomaticProgressionDelayMS int
,@InvertTrigger bit
,@InvertStart bit
,@ViewDiagnostics bit
,@VerifyChannels bit
,@AutoVerifyChannels bit
,@VerifyChannelsDelayMS int
,@RecordingMode smallint
,@SamplesPerSecond float
,@PreTriggerSeconds float
,@PostTriggerSeconds float
,@StrictDiagnostics bit
,@RequireConfirmationOnErrors bit
,@ROIDownload bit
,@ViewROIDownload bit
,@DownloadAll bit
,@ViewRealtime bit
,@RealtimePlotCount smallint
,@ROIStart float
,@ROIEnd float
,@ViewDownloadAll bit
,@Export bit
,@ExportFormat bigint
,@LabDetails nvarchar(50)
,@UseLabDetails bit
,@CustomerDetails nvarchar(50)
,@UseCustomerDetails bit
,@AllowMissingSensors bit
,@AllowSensorIdToBlankChannel bit
,@LocalOnly bit
,@LastModified datetime
,@LastModifiedBy nvarchar(50)
,@TurnOffExcitation bit
,@TriggerCheckRealtime bit
,@TriggerCheckStep bit
,@PostTestDiagnostics int
,@ExportFolder nvarchar(150)
,@DownloadFolder nvarchar(150)
,@CommonStatusLine bit
,@SameAsDownloadFolder bit
,@UploadData bit
,@UploadDataFolder nvarchar(150)
,@Settings nvarchar(255)
,@WarnOnBatteryFail bit
,@Dirty bit
,@Complete bit
,@Error nvarchar(255)
,@TestEngineerDetails nvarchar(50)
,@UseTestEngineerDetails bit
,@UserTags varbinary(max)
,@DoAutoArm bit
,@CheckoutMode bit
,@ISFFile nvarchar(4000)
,@QuitTestWithoutWarning bit
,@NotAllChannelsRealTime bit
,@NotAllChannelsViewer bit
,@SuppressMissingSensorsWarning bit
,@new_id int output
,@errorNumber int output
,@errorMessage nvarchar(250) output
AS
BEGIN
set @errorNumber = 0; set @errorMessage = space(0);
/* Table (and stored procedure) is too big... */
begin try
if(@TestSetupName is null)
begin
set @errorMessage = 'An invalid parameter or option was specified for procedure'
set @errorNumber = 15600
end
else
begin
SET NOCOUNT ON;
declare @TestEngineerId int
declare @LabratoryId int
declare @CustomerId int
set @CustomerId = dbo.foo_IdGetCustomer(@CustomerDetails)
set @LabratoryId = dbo.foo_IdGetLabratory(@LabDetails)
set @TestEngineerId = dbo.foo_IdGetEngineer(@TestEngineerDetails);
insert into [dbo].[TestSetups]
([TestSetupName]
,[SetupDescription]
,[AutomaticTestProgression]
,[AutomaticProgressionDelayMS]
,[InvertTrigger]
,[InvertStart]
,[ViewDiagnostics]
,[VerifyChannels]
,[AutoVerifyChannels]
,[VerifyChannelsDelayMS]
,[RecordingMode]
,[SamplesPerSecond]
,[PreTriggerSeconds]
,[PostTriggerSeconds]
,[StrictDiagnostics]
,[RequireConfirmationOnErrors]
,[ROIDownload]
,[ViewROIDownload]
,[DownloadAll]
,[ViewRealtime]
,[RealtimePlotCount]
,[ROIStart]
,[ROIEnd]
,[ViewDownloadAll]
,[Export]
,[ExportFormat]
,[CustomerId]
,[LabratoryId]
,[TestEngineerId]
,[LabDetails]
,[UseLabDetails]
,[CustomerDetails]
,[UseCustomerDetails]
,[TestEngineerDetails]
,[UseTestEngineerDetails]
,[AllowMissingSensors]
,[AllowSensorIdToBlankChannel]
,[LocalOnly]
,[LastModified]
,[LastModifiedBy]
,[TurnOffExcitation]
,[TriggerCheckRealtime]
,[TriggerCheckStep]
,[PostTestDiagnostics]
,[ExportFolder]
,[DownloadFolder]
,[CommonStatusLine]
,[SameAsDownloadFolder]
,[UploadData]
,[UploadDataFolder]
,[Settings]
,[WarnOnBatteryFail]
,[Dirty]
,[Complete]
,[ErrorMessage]
,[UserTags]
,[DoAutoArm]
,[CheckoutMode]
,[ISFFile]
,[QuitTestWithoutWarning]
,[NotAllChannelsRealTime]
,[NotAllChannelsViewer]
,[SuppressMissingSensorsWarning])
VALUES
( @TestSetupName
,@SetupDescription
,@AutomaticTestProgression
,@AutomaticProgressionDelayMS
,@InvertTrigger
,@InvertStart
,@ViewDiagnostics
,@VerifyChannels
,@AutoVerifyChannels
,@VerifyChannelsDelayMS
,@RecordingMode
,@SamplesPerSecond
,@PreTriggerSeconds
,@PostTriggerSeconds
,@StrictDiagnostics
,@RequireConfirmationOnErrors
,@ROIDownload
,@ViewROIDownload
,@DownloadAll
,@ViewRealtime
,@RealtimePlotCount
,@ROIStart
,@ROIEnd
,@ViewDownloadAll
,@Export
,@ExportFormat
,@CustomerId
,@LabratoryId
,@TestEngineerId
,@LabDetails
,@UseLabDetails
,@CustomerDetails
,@UseCustomerDetails
,@TestEngineerDetails
,@UseTestEngineerDetails
,@AllowMissingSensors
,@AllowSensorIdToBlankChannel
,@LocalOnly
,@LastModified
,@LastModifiedBy
,@TurnOffExcitation
,@TriggerCheckRealtime
,@TriggerCheckStep
,@PostTestDiagnostics
,@ExportFolder
,@DownloadFolder
,@CommonStatusLine
,@SameAsDownloadFolder
,@UploadData
,@UploadDataFolder
,@Settings
,@WarnOnBatteryFail
,@Dirty
,@Complete
,@Error
,@UserTags
,@DoAutoArm
,@CheckoutMode
,@ISFFile
,@QuitTestWithoutWarning
,@NotAllChannelsRealTime
,@NotAllChannelsViewer
,@SuppressMissingSensorsWarning)
set @new_id = scope_identity()
end
end try
begin catch
set @errorMessage = error_message()
set @errorNumber = error_number()
end catch;
END
GO