added LSL2 stored procedures
This commit is contained in:
223
LSL2/STPROC/SERVICE_SERVICES.txt
Normal file
223
LSL2/STPROC/SERVICE_SERVICES.txt
Normal file
@ -0,0 +1,223 @@
|
||||
Function Service_Services(@Service, @Params)
|
||||
/***********************************************************************************************************************
|
||||
|
||||
This program is proprietary and is not to be used by or disclosed to others, nor is it to be copied without written
|
||||
permission from SRP Computer Solutions, Inc.
|
||||
|
||||
Name : Service_Services
|
||||
|
||||
Description : Handler program for all module related services.
|
||||
|
||||
Notes : Service module to support environmental state issues. Environmental refers to the state of the
|
||||
operating system, which includes version, client vs. server, and path to critical systems.
|
||||
|
||||
Parameters :
|
||||
Service [in] -- Name of the service being requested
|
||||
Param1-10 [in/out] -- Additional request parameter holders
|
||||
Response [out] -- Response to be sent back to the Controller (MCP) or requesting procedure
|
||||
|
||||
Metadata :
|
||||
|
||||
History : (Date, Initials, Notes)
|
||||
02/06/18 dmb Original programmer.
|
||||
07/25/18 dmb Update the GetServices service to pick services without any assigned servers. This is to
|
||||
allow a service to be ran against any server.
|
||||
|
||||
***********************************************************************************************************************/
|
||||
|
||||
#pragma precomp SRP_PreCompiler
|
||||
|
||||
$insert LOGICAL
|
||||
$insert SERVICE_SETUP
|
||||
$insert SERVICES_EQUATES
|
||||
$insert RLIST_EQUATES
|
||||
$insert SQL_REQUESTS_EQUATES
|
||||
|
||||
Common /ServiceServices/ Unused1@, Unused2@, Unused3@, Unused4@, Unused5@, Unused6@, Unused7@, Unused8@, Unused9@, Unused10@
|
||||
|
||||
Declare function Service_Services, Memory_Services, SRP_List, SRP_FastArray, SRP_Array, Database_Services, Datetime
|
||||
Declare Function GetTickCount, SRP_Decode, RTI_CREATEGUID
|
||||
Declare subroutine Service_Services, Memory_Services, SRP_List, SRP_FastArray, RList, Set_Status, Database_Services
|
||||
Declare Subroutine Yield, WinYield, Sleepery
|
||||
|
||||
GoToService else
|
||||
Error_Services('Add', Service : ' is not a valid service request within the ' : ServiceModule : ' services module.')
|
||||
end
|
||||
|
||||
Return Response OR ''
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Service Parameter Options
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
Options BOOLEAN = True$, False$
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Services
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
// GetServices
|
||||
//
|
||||
// Returns an array of active services for the indicated server.
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
Service GetServices(Server)
|
||||
|
||||
Services = ''
|
||||
|
||||
If Server NE '' then
|
||||
Sentence = 'SELECT SERVICES WITH SERVER EQ ' : Quote(Server) : ' AND WITH ACTIVE EQ "Yes"'
|
||||
rv = Set_Status(0)
|
||||
RList(Sentence, TARGET_ACTIVELIST$, '', '', '')
|
||||
If (@List_Active EQ 3) AND (@RecCount GT 0) then
|
||||
EOF = False$
|
||||
Loop
|
||||
Readnext ServiceKeyID else EOF = True$
|
||||
Until EOF EQ True$
|
||||
ServiceRow = Database_Services('ReadDataRow', 'SERVICES', ServiceKeyID)
|
||||
If Error_Services('NoError') then
|
||||
Services := ServiceKeyID : @VM : ServiceRow<SERVICES.FREQUENCY$> : @VM : ServiceRow<SERVICES.SCHEDULE$> : @FM
|
||||
end
|
||||
Repeat
|
||||
end
|
||||
|
||||
Sentence = 'SELECT SERVICES WITH SERVER EQ "" AND WITH ACTIVE EQ "Yes"'
|
||||
rv = Set_Status(0)
|
||||
RList(Sentence, TARGET_ACTIVELIST$, '', '', '')
|
||||
If (@List_Active EQ 3) AND (@RecCount GT 0) then
|
||||
EOF = False$
|
||||
Loop
|
||||
Readnext ServiceKeyID else EOF = True$
|
||||
Until EOF EQ True$
|
||||
ServiceRow = Database_Services('ReadDataRow', 'SERVICES', ServiceKeyID)
|
||||
If Error_Services('NoError') then
|
||||
Services := ServiceKeyID : @VM : ServiceRow<SERVICES.FREQUENCY$> : @VM : ServiceRow<SERVICES.SCHEDULE$> : @FM
|
||||
end
|
||||
Repeat
|
||||
end
|
||||
Services[-1, 1] = ''
|
||||
end else
|
||||
Error_Services('Add', 'Server argument was missing from the ' : Service : ' service.')
|
||||
end
|
||||
|
||||
Response = Services
|
||||
|
||||
end service
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
// GetService
|
||||
//
|
||||
// Returns the details of the indicated service.
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
Service GetService(Service)
|
||||
|
||||
ServiceDetails = ''
|
||||
|
||||
If Service NE '' then
|
||||
ServiceDetails = Database_Services('ReadDataRow', 'SERVICES', Service)
|
||||
end else
|
||||
Error_Services('Add', 'Service argument was missing from the ' : Service : ' service.')
|
||||
end
|
||||
|
||||
Response = ServiceDetails
|
||||
|
||||
end service
|
||||
|
||||
|
||||
Service ProcessProcedureQueue()
|
||||
|
||||
hValidationRequests = Database_Services('GetTableHandle', 'PROC_QUEUE')
|
||||
If Error_Services('NoError') then
|
||||
Sentence = "SELECT PROC_QUEUE WITH COMP_DTM NE ''"
|
||||
Set_Status(0)
|
||||
RList(Sentence, TARGET_ACTIVELIST$, '', '', '')
|
||||
EOF = False$
|
||||
Loop
|
||||
ReadNext RequestKeyID else EOF = True$
|
||||
Until EOF
|
||||
Lock hValidationRequests, RequestKeyID then
|
||||
RequestRow = Database_Services('ReadDataRow', 'PROC_QUEUE', RequestKeyID)
|
||||
If RequestRow NE '' then
|
||||
Procedure = RequestRow<1>
|
||||
Params = RequestRow<2>
|
||||
If Procedure NE '' then
|
||||
Dim ProcParams(10)
|
||||
For each Param in Params using @VM setting pPos
|
||||
ProcParams(pPos) = Param
|
||||
Next Param
|
||||
NumArguments = DCount(Params, @VM)
|
||||
Begin Case
|
||||
Case NumArguments EQ 0 ; Call @Procedure()
|
||||
Case NumArguments EQ 1 ; Call @Procedure(ProcParams(1))
|
||||
Case NumArguments EQ 2 ; Call @Procedure(ProcParams(1), ProcParams(2))
|
||||
Case NumArguments EQ 3 ; Call @Procedure(ProcParams(1), ProcParams(2), ProcParams(3))
|
||||
Case NumArguments EQ 4 ; Call @Procedure(ProcParams(1), ProcParams(2), ProcParams(3), ProcParams(4))
|
||||
Case NumArguments EQ 5 ; Call @Procedure(ProcParams(1), ProcParams(2), ProcParams(3), ProcParams(4), ProcParams(5))
|
||||
Case NumArguments EQ 6 ; Call @Procedure(ProcParams(1), ProcParams(2), ProcParams(3), ProcParams(4), ProcParams(5), ProcParams(6))
|
||||
Case NumArguments EQ 7 ; Call @Procedure(ProcParams(1), ProcParams(2), ProcParams(3), ProcParams(4), ProcParams(5), ProcParams(6), ProcParams(7))
|
||||
Case NumArguments EQ 8 ; Call @Procedure(ProcParams(1), ProcParams(2), ProcParams(3), ProcParams(4), ProcParams(5), ProcParams(6), ProcParams(7), ProcParams(8))
|
||||
Case NumArguments EQ 9 ; Call @Procedure(ProcParams(1), ProcParams(2), ProcParams(3), ProcParams(4), ProcParams(5), ProcParams(6), ProcParams(7), ProcParams(8), ProcParams(9))
|
||||
Case Otherwise$ ; Call @Procedure(ProcParams(1), ProcParams(2), ProcParams(3), ProcParams(4), ProcParams(5), ProcParams(6), ProcParams(7), ProcParams(8), ProcParams(9), ProcParams(10))
|
||||
End Case
|
||||
end
|
||||
end
|
||||
If Error_Services('NoError') then
|
||||
RequestRow<3> = DateTime()
|
||||
end else
|
||||
RequestRow<3> = DateTime()
|
||||
RequestRow<4> = Error_Services('GetMessage')
|
||||
end
|
||||
Database_Services('WriteDataRow', 'PROC_QUEUE', RequestKeyID, RequestRow, True$, False$, True$)
|
||||
Unlock hValidationRequests, RequestKeyID else Null
|
||||
end
|
||||
Repeat
|
||||
end
|
||||
|
||||
end service
|
||||
|
||||
|
||||
Service PostProcecure(ProcedureName, Params)
|
||||
|
||||
Response = ''
|
||||
If (ProcedureName NE '') then
|
||||
RequestKeyID = RTI_CreateGUID()
|
||||
RequestRow = ''
|
||||
RequestRow<SQL_REQUESTS.DB_PATH$> = ''
|
||||
RequestRow<SQL_REQUESTS.QUERY$> = ''
|
||||
Database_Services('WriteDataRow', 'SQL_REQUESTS', RequestKeyID, RequestRow, False$, False$, False$)
|
||||
If Error_Services('NoError') then
|
||||
TimeExpired = False$
|
||||
Start = GetTickCount()
|
||||
Loop
|
||||
RequestRow = Database_Services('ReadDataRow', 'SQL_REQUESTS', RequestKeyID)
|
||||
ResponseDate = RequestRow<SQL_REQUESTS.RESPONSE_DATE$>
|
||||
If ResponseDate NE '' then
|
||||
Response = RequestRow<SQL_REQUESTS.RESPONSE$>
|
||||
Response = SRP_Decode(Response)
|
||||
end
|
||||
// Time will expire after 30 seconds.
|
||||
If GetTickCount() - Start GE 30000 then TimeExpired = True$
|
||||
Until (ResponseDate NE '') OR TimeExpired
|
||||
Sleepery(10)
|
||||
WinYield()
|
||||
Yield();Yield();Yield();Yield();Yield();Yield();Yield();Yield()
|
||||
Repeat
|
||||
If TimeExpired then
|
||||
Error_Services('Add', 'Timed out attempting to retrieve wafer image.')
|
||||
end
|
||||
Database_Services('DeleteDataRow', 'SQL_REQUESTS', RequestKeyID, True$)
|
||||
end
|
||||
end else
|
||||
Error_Services('Add', 'Null parameter passed into service call. All parameters are required.')
|
||||
end
|
||||
|
||||
return
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Internal GoSubs
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
Reference in New Issue
Block a user