Lesson 6 – Index Inconsistencies
Scenario
In this lesson, you have a Btrieve file with indexes set that are inconsistent with the indexes set in the table definition.
Goals
The goal is to open the file with DDF Builder and see if DDF Builder updates any of the definitions. You will inspect any changes that DDF Builder implements and discuss changes that are needed to fix the index inconsistencies.
*Tip: DDF Builder recommends solutions to fix the inconsistencies in your indexes and allows you to save those changes.
What You Need to Know
For this lesson, use the file named INDEX_INC.MKD. This file resides in a folder named Tutorial2. Assuming you installed using the default installation locations, this folder is located at:
<Application Data>\DDFBUILDER\TUTORIALS\TUTORIAL2
This folder is part of the Tutorial2 database.
*Note: You must have a Data Source Name (DSN) that points to this database in order to access the data in this tutorial. If you have not yet created this DSN, refer to Create Data Source Names (DSN).
Open the Btrieve File
You should have DDF Builder already running from the last lesson. If not, begin by starting DDF Builder.
1
2
3
4
The Table Definition Editor opens and displays the following message:
This message tells you that DDF Builder has analyzed your existing table definitions and found problems with those definitions. As a result of this, DDF Builder had to make some modifications to open and display the existing table definitions.
5
Click OK to clear the message and display the table definition.
*Tip: For a complete list of possible definition errors, refer to Table Definition Errors.
Look for Inconsistencies
Begin by looking at the DDF Builder interface to review the inconsistencies found. Start by doing a quick comparison of the grid data view to the original definition.
For this lesson, DDF Builder does not give any visual indications as to the columns that need attention. No unknown column indicators suggest that any of the fields have been altered.
Interestingly enough, you can compare these two definitions and find no differences. Although DDF Builder has made changes, they do not appear in the table definition views because the issues DDF Builder corrected are in the indexes.
Before you look at the index information in detail, take a moment to review the problems listed in the Definition Errors window. A list of the issues DDF Builder detected and changed display in the Definition Errors view.
*Note: DDF Builder changes are not automatically saved. Any modifications made by DDF Builder must be saved.
Understanding the Errors
The Definition Errors view tells the following:
*Tip: DDF Builder cannot alter your Btrieve file. Any changes made are to the table definition and not the Btrieve file.
The Definition Errors lists two problems:
The first error shows that the existing table definition contains an index that does not exist in the Btrieve file. Because DDF Builder cannot change the Btrieve file—only alter table definitions—the index is ignored. This is important to know so that you do not try and use an index that does not exist.
The second error is the opposite situation. The existing table definition does not contain an index that is defined in the Btrieve file. DDF Builder added an SQL index to represent the index in the Btrieve file that was previously undefined.
Assign a name to the index that DDF Builder created, and accept the changes made to the table definition index.
*Note: In the event you have indexes created by DDF Builder that are no longer needed, you may benefit from dropping the index from the file and the table definition. Similarly, you may find that you need to add indexes that were not defined when DDF Builder modified your table definitions. In either case, refer to the PSQL Programmer's Guide for information on adding and dropping indexes.
Name the Index
1
Select the Indexes tab in the Table Definition Editor.
2
3
*Note: To see the indexes defined on the Btrieve file, click the Statistics tab.
Save the Table Definition
Now that you verified the index DDF Builder added to the table definition, save your work for the changes to take effect. Before you save your work, take one final look at the table definition.
All of the Btrieve Types have been defined, there are no undefined fields remaining and every byte is accounted for. You can now save your table definition.
1
From the menu bar, click FileSave to save the table definition.
Conclusion
Congratulations, you have successfully saved your table definition. This lesson introduced you to some of the inconsistencies in indexes that DDF Builder recognizes. It also covered the modifications that DDF Builder makes and how you save the updated table definition.