Making a new Index: Invalid Index Descriptor (CDX) 
Author Message
 Making a new Index: Invalid Index Descriptor (CDX)

I hope you can help me on this one:

I am writing an automatic maintenance utility that runs a background
thread late at night. This thread creates a TTable on the fly and
opens the databases in a directory. Then it deletes all the indexes on
that table and then recreates them according to a configuration file
(that way I can add new indexes without asking my users to exit).

My problem is this: Sometimes, people open the table with FoxPro and
create a CDX. My main delphi App reacts fine, ignoring the CDX and
using the MDX instead, but when I try to recreate the index with my
background process I get the following error when creating the index:

Invalid index descriptor
Index does not exist
File: \\Server\Directories\File.CDX.

I am already specifying the table type as ttDBase (I am using Delphi
3).

Does anybody know how the DBF knows what kind of CDX to look for? I
need to be able to either switch the DBF header back to MDX
programatically (a-la-foxpro) or be able to recreate my MDX's ignoring
the fact that somebody opened the DBF with foxpro.

My code looks like this:

To Delete my index definitions, I am using:

        for iCounter := 0 to tblTableToReindex.IndexDefs.Count - 1 do
        begin
          strIndexToDelete := lstIndexList.Strings[iCounter];
          tblTableToReindex.DeleteIndex(strIndexToDelete);
          WriteLn(FLogFile,'        Index '+strIndextoDelete+'
Deleted');
        end;

And a little later, to recreate them from the configuration structure

        try

tblTableToReindex.AddIndex(FileToIndex.Indexes.Items[iCounter].Name,

FileToIndex.Indexes.Items[iCounter].Fields,

FileToIndex.Indexes.Items[iCounter].Options);
            tblTableToReindex.IndexDefs.Update;
            WriteLn(FLogFile,'        Index '+
FileToIndex.Indexes.Items[iCounter].Name +
                                     ' created:
'+FileToIndex.Indexes.Items[iCounter].Fields);
          except
            on E: Exception do WriteLn(FLogFile,'        ** ERROR
Creating index '+ FileToIndex.Indexes.Items[iCounter].Name +'!!
['+E.Message+']');
          end;

The config structure "FileToIndex" looks something like:

TFileToIndex = class
    FileName: String;
    Indexes : TIndexDefs;
    Constructor Create;
  end;

David Martinez

http://www.*-*-*.com/
Please Delete Spam Protection to email



Tue, 26 Oct 1999 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Invalid index Descriptor !!?!?!?!?!?

2. D3, FoxPro, DESCEND(), Invalid Index Descriptor

3. Delphi 5 , Foxpro CDX Indexes and CLIPPER

4. Mysterious CDX index error

5. CDX indices

6. DBF file with CDX index

7. How to create CDX-indexes in Delphi 4?

8. Problem with rebuild index files for ( DBF + CDX )

9. Foxpro CDX indexes in Delphi

10. cdx indexes, what does the error mean?

11. dBase cdx index

12. BDE and Clipper / CDX index help...Is this natively supported

 

 
Powered by phpBB® Forum Software