added LSL2 stored procedures
This commit is contained in:
57
LSL2/STPROC/DONT_USE_MODS_MANUAL_DELETE.txt
Normal file
57
LSL2/STPROC/DONT_USE_MODS_MANUAL_DELETE.txt
Normal file
@ -0,0 +1,57 @@
|
||||
compile function dont_use_mods_manual_delete()
|
||||
begin condition
|
||||
pre:
|
||||
post:
|
||||
end condition
|
||||
|
||||
$insert logical
|
||||
$insert rlist_equates
|
||||
$insert msg_equates
|
||||
declare function utility, msg, mods_load_control
|
||||
declare subroutine record_lock, recompile_proc
|
||||
|
||||
* PLACE THE SELECT STATEMENT HERE I.E. SELECT THE ROWS YOU WISH TO DELETE
|
||||
Stmt = 'SELECT MODS WITH MOD_ID "[ERROR]"'
|
||||
|
||||
Stat = utility( 'CURSOR', 'H' )
|
||||
|
||||
rlist( Stmt, target_activelist$, '', '', '' )
|
||||
*rlist( Stmt, target_savelist$, 'MODS_TO_DEL', '', '' )
|
||||
DEBUG
|
||||
Stat = utility( 'CURSOR', 'A' )
|
||||
|
||||
DeletedRows = 0
|
||||
if @reccount then
|
||||
Stat = utility( 'CURSOR', 'H' )
|
||||
open 'MODS' to ModsTable else
|
||||
Void = msg( '', 'Unable to open MODS...' )
|
||||
return 0
|
||||
end
|
||||
Eof = false$
|
||||
loop
|
||||
readnext Id else Eof = true$
|
||||
until eof
|
||||
record_lock( ModsTable, 'MODS', Id )
|
||||
delete ModsTable, Id else
|
||||
Void = msg( '', 'Unable to delete ':Id:' in MODS' )
|
||||
return 0
|
||||
end
|
||||
unlock ModsTable, Id else
|
||||
Void = msg( '', 'Unable to unlock ':Id:' in MODS' )
|
||||
return 0
|
||||
end
|
||||
DeletedRows += 1
|
||||
repeat
|
||||
Stat = utility( 'CURSOR', 'A' )
|
||||
MsgInfo = ''
|
||||
MsgInfo<mtext$> = DeletedRows:' rows were deleted...'
|
||||
MsgInfo<micon$> = '!'
|
||||
Void = msg( '', MsgInfo )
|
||||
end else
|
||||
MsgInfo = ''
|
||||
MsgInfo<mtext$> = 'There are no rows in the MODS table...that match the select statement'
|
||||
MsgInfo<micon$> = '!'
|
||||
Void = msg( '', MsgInfo )
|
||||
return 0
|
||||
end
|
||||
return 0
|
Reference in New Issue
Block a user