added LSL2 stored procedures
This commit is contained in:
125
LSL2/STPROC/SRP_RTP65.txt
Normal file
125
LSL2/STPROC/SRP_RTP65.txt
Normal file
@ -0,0 +1,125 @@
|
||||
Function SRP_RTP65(Service, Param1, Param2, Param3)
|
||||
|
||||
/********************************************************************************************************
|
||||
|
||||
This program is proprietary and is not to be used by or disclosed to others, nor is it to
|
||||
be copied without written permission.
|
||||
|
||||
Name : SRP RTP65
|
||||
|
||||
Description : Service shell for RTP65(Method, Handle, Key, Record, Reserved, Status)
|
||||
|
||||
Notes :
|
||||
|
||||
Parameters :
|
||||
|
||||
History (Date, Initials, Notes)
|
||||
05/06/10 fjt Initial development
|
||||
|
||||
********************************************************************************************************/
|
||||
|
||||
Declare subroutine RTP65
|
||||
|
||||
$insert SERVICE_INSERT
|
||||
|
||||
Equ Create$ to 0
|
||||
Equ Open$ to 1
|
||||
Equ Close$ to 2
|
||||
Equ Clear$ to 3
|
||||
Equ Read$ to 4
|
||||
Equ Write$ to 5
|
||||
Equ Delete$ to 6
|
||||
|
||||
Ans = 0
|
||||
|
||||
Begin Case
|
||||
Case Service EQ "R" ; Gosub ReadRecord
|
||||
Case Service EQ "W" ; Gosub WriteRecord
|
||||
Case Service EQ "D" ; Gosub DeleteRecord
|
||||
***
|
||||
Case Service EQ "C" ; Gosub CreateTable
|
||||
Case Service EQ "O" ; Gosub OpenTable
|
||||
Case Service _eqc "Clear" ; Gosub ClearTable
|
||||
Case Service _eqc "Close" ; Gosub CloseTable
|
||||
End Case
|
||||
|
||||
GoSub Errors
|
||||
|
||||
Return Ans
|
||||
|
||||
|
||||
!----- RECORD METHODS -----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
ReadRecord:
|
||||
// Reads a record from an open RTP65 table
|
||||
Key = Param2
|
||||
RTP65(Read$, Param1, Key, Rec, "", Ans)
|
||||
If Assigned(Rec) else Rec = ""
|
||||
Transfer Rec to Param3
|
||||
return
|
||||
|
||||
|
||||
WriteRecord:
|
||||
// Writes a record to an open RTP65 table
|
||||
Key = Param2
|
||||
Rec = Param3
|
||||
RTP65(Write$, Param1, Key, Rec, "", Ans)
|
||||
return
|
||||
|
||||
|
||||
DeleteRecord:
|
||||
// Deletes a record from an open RTP65 table
|
||||
Handle = Param1
|
||||
Key = Param2
|
||||
RTP65(Write$, Handle, Key, "", "", Ans)
|
||||
return
|
||||
|
||||
|
||||
!----- TABLE METHODS ------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
CreateTable:
|
||||
// Use this method to create an in-memory hash table
|
||||
Table = Param1
|
||||
RTP65(Create$, "", Table, "", "", Ans)
|
||||
return
|
||||
|
||||
|
||||
OpenTable:
|
||||
// Opens a previously created RTP65 table
|
||||
// Use this method to obtain a handle to the table before using any other RTP65 record methods
|
||||
Table = Param1
|
||||
RTP65(Open$, Handle, Table, "", "", Ans)
|
||||
Transfer Handle to Param2
|
||||
return
|
||||
|
||||
|
||||
ClearTable:
|
||||
// Deletes all data from a previously opened RTP65 table
|
||||
Handle = Param1
|
||||
RTP65(Clear$, Handle, "", "", "", Ans)
|
||||
return
|
||||
|
||||
|
||||
CloseTable:
|
||||
// Closes a previously created RTP65 table
|
||||
Handle = Param1
|
||||
RTP65(Close$, Handle, "", "", "", Ans)
|
||||
return
|
||||
|
||||
|
||||
!----- ERRORS / STATUS ----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Errors:
|
||||
Begin Case
|
||||
Case Ans EQ 0 ; Ans = "(0) Success"
|
||||
Case Ans EQ 1 ; Ans = "(1) Table already exists"
|
||||
Case Ans EQ 2 ; Ans = "(2) Table does not exist"
|
||||
Case Ans EQ 3 ; Ans = "(3) Bad Table Handle"
|
||||
Case Ans EQ 4 ; Ans = "(4) Table has not been opened or Record does not exist"
|
||||
Case Ans EQ 5 ; Ans = "(5) Maximum number of tables exceeded"
|
||||
Case Ans EQ 6 ; Ans = "(6) Memory Error"
|
||||
End Case
|
||||
return
|
Reference in New Issue
Block a user