added LSL2 stored procedures
This commit is contained in:
52
LSL2/STPROC/DELETE_TABLE_FROM_SQL.txt
Normal file
52
LSL2/STPROC/DELETE_TABLE_FROM_SQL.txt
Normal file
@ -0,0 +1,52 @@
|
||||
Compile subroutine Delete_Table_From_SQL(Table, NumToDelete)
|
||||
|
||||
/*****************************************************************************\
|
||||
This is a utility function. For every key listed in SYSLISTS*DELETE_TABLE_FROM_SQL_ERRORS,
|
||||
the corresponding record (and related supporting table records) are deleted.
|
||||
|
||||
History
|
||||
-------
|
||||
09/15/2010 KRF Original Programmer
|
||||
\*****************************************************************************/
|
||||
debug
|
||||
Equ Update_Interval$ to 1000
|
||||
|
||||
If Assigned(NumToDelete) else NumToDelete = 0
|
||||
Errors = ""
|
||||
|
||||
Declare function Delete_Record_From_SQL, GetTickCount, Get.RecCount
|
||||
|
||||
NumDeleted = 0
|
||||
|
||||
StartTime = GetTickCount()
|
||||
|
||||
OldErrors = Xlate("SYSLISTS", "DELETE_TABLE_FROM_SQL_ERRORS", "", "X")
|
||||
NumOldErrors = Count(OldErrors, @FM) + (OldErrors NE "")
|
||||
RecCount = NumOldErrors
|
||||
For iOldError = 1 to NumOldErrors
|
||||
Key = OldErrors<iOldError, 1>
|
||||
GoSub Delete_Key
|
||||
Next iOldError
|
||||
|
||||
Open "SYSLISTS" to hSYSLISTS then
|
||||
Write Errors to hSYSLISTS, "COPY_TABLE_TO_SQL_ERRORS"
|
||||
Call SRP_Editor_Open("Record", "SYSLISTS":@FM:"COPY_TABLE_TO_SQL_ERRORS")
|
||||
end
|
||||
|
||||
Return
|
||||
|
||||
Delete_Key:
|
||||
|
||||
Error = Delete_Record_From_SQL(Table, Key)
|
||||
If Len(Error) then
|
||||
Errors := Key:@VM:Error:@FM
|
||||
end
|
||||
|
||||
NumDeleted += 1
|
||||
If GetTickCount() - StartTime GE Update_Interval$ then
|
||||
TotalToDelete = If NumToDelete GT 0 then NumToDelete else RecCount
|
||||
Call SRP_Editor_Send_Info("Processed: ":NumDeleted:" / ":TotalToDelete)
|
||||
StartTime = GetTickCount()
|
||||
end
|
||||
|
||||
return
|
Reference in New Issue
Block a user