Board index » delphi » Invalid index descriptor

Invalid index descriptor

How to find which records was corrupted?
Please, any advices.
 

Re:Invalid index descriptor


What database are you using?

--
Bill

Re:Invalid index descriptor


DBASE For Windows.

I am not able to recreate anyone index.

I have been delete all indexes, but I couldn't create again. Same error.

---------

I'm sorry, I replayed by mistake to your email.

Re:Invalid index descriptor


On Thu, 29 Mar 2001 15:46:11 -0500, "Maxim" <m...@prencocorp.com>
wrote:

Quote
>DBASE For Windows.

>I am not able to recreate anyone index.

>I have been delete all indexes, but I couldn't create again. Same error.

The easiest way to check for data corruption of a dBase file, is to
start reading the data part (after the header).
You can use the following structure to read the header of the DBF
file:

type
  TDBFInitRec = record
    nType: Byte;
    nYear: Byte;
    nMonth: Byte;
    nDay: Byte;
    iNbrRec: Longint;
    wStart: Word;
    wRecSize: Word;
    Unused1: Word;
    bIncomplete: Boolean;
    bEncrypted: Boolean;
    sMultiUser: array [0..11] of Char;
    nFlags: Byte;
    nLang: Byte;
    Unused2: Word;
  end;

The data part starts at the offset given by wStart.  When you suppose
that the field structures are okay, you can use a PChar buffer with
the size of wRecSize to read record per record.  You'll have to use
direct file access to read both the header and the records.  You could
use TFileStream, for example, which is an easy way to access a file
(but not the fastest).

The first character of the record buffer should always be ' ' (space)
for normal records or '*' (asterisk) for deleted records.  Every
character within the range of 0..31 in the record buffer is suspicious
and should likely be regarded as corruption because DBF files normally
contain only ASCII values.

HTH,

Jan

Re:Invalid index descriptor


Thanks a lot, Jan

Very clear and useful advice.

Quote
"Jan Sprengers" <j...@nospamplease.adm2000.be> wrote in message

news:3ac8256d.2273138@newsgroups.borland.com...
Quote
> On Thu, 29 Mar 2001 15:46:11 -0500, "Maxim" <m...@prencocorp.com>
> wrote:

> >DBASE For Windows.

> >I am not able to recreate anyone index.

> >I have been delete all indexes, but I couldn't create again. Same error.

> The easiest way to check for data corruption of a dBase file, is to
> start reading the data part (after the header).
> You can use the following structure to read the header of the DBF
> file:

> type
>   TDBFInitRec = record
>     nType: Byte;
>     nYear: Byte;
>     nMonth: Byte;
>     nDay: Byte;
>     iNbrRec: Longint;
>     wStart: Word;
>     wRecSize: Word;
>     Unused1: Word;
>     bIncomplete: Boolean;
>     bEncrypted: Boolean;
>     sMultiUser: array [0..11] of Char;
>     nFlags: Byte;
>     nLang: Byte;
>     Unused2: Word;
>   end;

> The data part starts at the offset given by wStart.  When you suppose
> that the field structures are okay, you can use a PChar buffer with
> the size of wRecSize to read record per record.  You'll have to use
> direct file access to read both the header and the records.  You could
> use TFileStream, for example, which is an easy way to access a file
> (but not the fastest).

> The first character of the record buffer should always be ' ' (space)
> for normal records or '*' (asterisk) for deleted records.  Every
> character within the range of 0..31 in the record buffer is suspicious
> and should likely be regarded as corruption because DBF files normally
> contain only ASCII values.

> HTH,

> Jan

Other Threads