51 lines
1.3 KiB
Plaintext
51 lines
1.3 KiB
Plaintext
compile function update_index_rep( TableName, ColumnName)
|
|
|
|
$insert logical
|
|
|
|
declare subroutine index.flush
|
|
declare function msg
|
|
|
|
Continue = true$
|
|
if TableName <> '' then
|
|
* see if there are any transactions waiting....
|
|
TransWaiting = xlate('!':TableName, '0', '', 'X')
|
|
if (len(TransWaiting)) and ((len(TransWaiting) > 2) or (TransWaiting<1> <> 0)) else
|
|
Continue = false$
|
|
end
|
|
end else
|
|
TableName = ''
|
|
ColumnName = ''
|
|
end
|
|
|
|
if Continue then
|
|
flush
|
|
garbagecollect
|
|
* place lock on imaginary file to coordinate that only one station
|
|
* at a time does the INDEX.FLUSH
|
|
open 'SYSLISTS' to SysListsTable else
|
|
Void = msg( '', 'Unable to open SYSLISTS...' )
|
|
return 0
|
|
end
|
|
LockID = 'INDEX.FLUSH*':TableName
|
|
MsgUp = false$
|
|
loop
|
|
Locked = true$
|
|
lock SysListsTable, LockID else Locked = false$
|
|
until Locked
|
|
if status() then
|
|
* locked by this station - shouldn't happen, but if it is, proceed
|
|
Locked = true$
|
|
end
|
|
repeat
|
|
* have the lock, now do the update
|
|
index.flush( TableName, ColumnName)
|
|
flush
|
|
garbagecollect
|
|
* now, release the lock
|
|
unlock SysListsTable, LockID else
|
|
Void = msg( '', 'Unable to unlock syslists ':LockId )
|
|
return 0
|
|
end
|
|
end
|
|
return
|