Board index » delphi » Recover Deleted records in Paradox table

Recover Deleted records in Paradox table

If anyone knows if there is a way to see the deleted records from a paradox
table, I would appreciate an answer.
It is definitely not deleted 100% because the file size stays the same, and
if I open it in Excel I get the records all mixed up, so I assume there is a
way to view these records.
Thanks
 

Re:Recover Deleted records in Paradox table


There is no way to see deleted records in a Paradox file. A Paradox table is
a doubly linked list of fixed size blocks. Assume a block can hold a maximum
of three records numbered one through five. If you delete record two then
record three is moved up to fill the space overwriting record two. If you
deleted the last record in a block it would not be physically overwritten
but there is no way to access it.

--
Bill Todd (TeamB)
(Questions received via email cannot be answered.)

Re:Recover Deleted records in Paradox table


Quote
"Bill Todd (TeamB)" wrote:
> .... If you delete record two then
> record three is moved up to fill the space overwriting record two. If you

Really ? I was under the impression (mistaken perhaps ?) that during deletion NO
records get moved on disk, all that happens is that the links are revised so
that the deleted record no longer is in either the forward or reverse list.
Records only get moved when one repacks the table which fills all the "gaps" by
physically moving records up towards the beginning of the file.

This implies that it might be possible to devise some scheme to recover a lost
record provided no other records have been added (which would first be put into
the gaps), and that the table hadn't been repacked, but the technique would not
use the "normal" table access techniques or indeed the BDE, you'd have to write
your own low level file access tricks.

Re:Recover Deleted records in Paradox table


Your understanding is not correct. Records are not linked in a Paradox
table. The blocks are maintained in a doubly linked list with the links
arranged so that the block chain is in primary key order. Each block holds
multiple records. Within each block the records are maintained in primary
key order. The combination of the sorted block chain and the sorted records
within a block provides the clustered index used for the primary key. Each
block contains three 32 bit values used for housekeeping. One is the number
of the prior block in the chain, the second is the number of the next block
in the chain. These two values provide the doubly linked list of blocks. The
third value is the number of the last record in the block. If the block can
hold 20 records but at the moment only contains five records the last record
number is set to five. This means that there can not be any holes occupied
by records that were deleted. Since Paradox records, unlike Dbase records,
do not contain a deleted flag if the record count says there are five
records in the block then those five records _must_ ocuupy the first five
slots in the block. If record three is deleted the record count is set to
four and records four and five are moved up one slot so that the four
remaining records now occupy the first four slots in the block. Trust me<g>.
This _is_ the way Paradox tables work.

--
Bill Todd (TeamB)
(Questions received via email cannot be answered.)

Other Threads