89 lines
2.6 KiB
Plaintext
89 lines
2.6 KiB
Plaintext
function mods_update_specific()
|
|
|
|
$insert logical
|
|
$insert rlist_equates
|
|
$insert msg_equates
|
|
declare function utility, msg, mods_load_control
|
|
declare subroutine record_lock, recompile_proc
|
|
|
|
Stat = utility( 'CURSOR', 'H' )
|
|
UpdatedRows = 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
|
|
ProcessErr = false$
|
|
record_lock( ModsTable, 'MODS', Id )
|
|
RowToUse = xlate( 'MODS', Id, '', 'X' )
|
|
App = field( Id, '`', 1 )
|
|
Table = field( Id, '`', 2 )
|
|
Row = field( Id, '`', 3 )
|
|
Date = field( Id, '`', 4 )
|
|
Time = field( Id, '`', 5 )
|
|
UpdateType = field( Id, '`', 6 )
|
|
begin case
|
|
case UpdateType = 'WR'
|
|
open Table to TableVar else
|
|
Void = msg( '', 'Unable to open ':Table )
|
|
return 0
|
|
end
|
|
record_lock( TableVar, Table, Row )
|
|
write RowToUse on TableVar, Row else
|
|
Void = msg( '', 'Unable to write ':Row:' on ':Table )
|
|
ProcessErr = true$
|
|
*return 0
|
|
end
|
|
unlock TableVar, Row else
|
|
Void = msg( '', 'Unable to unlock ':Row:' in ':Table )
|
|
ProcessErr = true$
|
|
*return 0
|
|
end
|
|
if Table = 'SYSPROCS' and ( Row[-4,4] <> '_EQU' ) then
|
|
recompile_proc(Row)
|
|
Err = ''
|
|
if get_status(Err) Then
|
|
Void = msg( '', 'Error while compiling ':quote(Row) )
|
|
end
|
|
end
|
|
case UpdateType = 'DR'
|
|
record_lock( TableVar, Table, Row )
|
|
delete TableVar, Row else
|
|
Void = msg( '', 'Unable to delete ':Row:' on ':Table )
|
|
ProcessErr = true$
|
|
*return 0
|
|
end
|
|
unlock TableVar, Row else
|
|
Void = msg( '', 'Unable to unlock ':Row:' in ':Table )
|
|
ProcessErr = true$
|
|
*return 0
|
|
end
|
|
end case
|
|
if ProcessErr else
|
|
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
|
|
UpdatedRows += 1
|
|
end
|
|
repeat
|
|
Stat = utility( 'CURSOR', 'A' )
|
|
MsgInfo = ''
|
|
MsgInfo<mtext$> = UpdatedRows:' rows were updated...'
|
|
MsgInfo<micon$> = '!'
|
|
Void = msg( '', MsgInfo )
|
|
Void = mods_load_control()
|
|
end
|
|
return 0
|
|
|
|
|