RE: EU Database delimma
- Posted by Jonas Temple <jktemple at yhti.net> Aug 15, 2001
- 440 views
George Walters wrote: > The issue here is setting up a program that needs to 'readnext' or > 'readprev' though a file doing maintenance to the file. consider the > following. > > Customer's c5400,c5450,c5500,c5550,....... > > I'm reading next through the file by incrementing the record pointer and > decide I need to delete c5450. EU then changes all the file pointers and > suffels them down from c5500. this breaks my read 'readnext' since > incrementing the record pointer would skip c5500. If on a delete record > function I decrement the pointer to fix the 'readnext' I would break the > 'readprev'. It would seem that changing the record numbers on the fly is > not > a good thing. Has anyone else figured a way to fix this Dilemma? I don't > know how I could write an update program to effectively deal with this. > it > would be too confusing to keep a group of 'del' pointers for every > db/table > than is open. Thoughts? George, You could handle this with something like: i = 1 while i <= db_table_size() do record_key = db_record_key(i) if record_key[CUSTOMER] = 5450 then db_delete_record(i) else i += 1 end if if i >= db_table_size() then exit end if end while The trick here is that you should always check your record number against the table size whenever the record number is incremented to get the next record. Hope this helps. Jonas