Most recent edit on 2005-07-14 01:46:34 by NorbertGutscher
No differences.
Oldest known version of this page was edited on 2005-07-14 01:45:24 by NorbertGutscher []
Page view:
CategoryDataBases CategoryHowTo
Originally posted by Steve Blank
I just spent some time playing with the DDF Make utility in Magic v9.3 SP5 and I think I found a way to make it work semi-reliably, at least enough to do the lion's share of the work. But there are some tricks involved, so follow along closely:
How To Create a New Data Dictionary
Step 1
Use Magic's DDF Make Utility to create a new set of DDFs containing a single table definition. To do this, open Magic's Table Repository, highlight one table (it matters not which one) and press Ctrl+D or select Options | DDF Make from the pull down menus. This action creates four DDFs in the same directory as that in which the Magic executables are located. These files are named FILE.DDF, FIELD.DDF, FIELDEXT.DDF and INDEX.DDF.
IMPORTANT:
FIELDEXT.DDF is a hold-over from days gone by, but don't delete it -- repeat -- DO NOT DELETE FIELDEXT.DDF. I used to tell people to delete it, however, I just discovered that the mere existence of this file is required in order to get Magic's DDF Make utility to play nice.
Step 2
Use either the Pervasive Control Center or the Windows ODBC Administrator applet (located in the Windows Control Panel) to create a new Database in some out of the way location, a location that is NOT the same location as that in which your Magic executables are stored, nor the same location as that in which your live data files are stored.
IMPORTANT:
Make sure you do NOT create a "Bound" database -- if you create a bound database, your DDFs will not be portable and you NEED them to be portable.
Step 3
The action performed in Step 2 caused the SRDE to create three new DDFs, files called FILE.DDF, FIELD.DDF and INDEX.DDF. COPY these three files into the directory wherein your Magic executables are stored, overwriting the three files of the same names that you created in Step 1. I say COPY (not MOVE) because it's nice to keep a set of pristine DDFs for future use.
NOTE:
At this point, you have four DDFs in the same directory as that in which your Magic executables are stored, as follows:
A) FILE.DDF Created by Pervasive.SQL
B) FIELD.DDF Created by Pervasive.SQL
C) FIELDEXT.DDF Created by Magic
D) INDEX.DDF Created by Pervasive.SQL
Step 4
Use Magic's DDF Make Utility to populate the DDFs with table definitions. One by one, highlight the table you want to add to the DDFs and press Ctrl+D or select Options | DDF Make from the pull down menus.
Step 5
COPY the three DDFs named FILE.DDF, FIELD.DDF and INDEX.DDF from the directory in which your Magic executables are stored to the directory in which your data files are stored.
Step 6
Run the Pervasive Control Center's Check Database Wizard to check all of the table definitions for inconsistencies and correct any/all problems identified using the PCC's Table Designer utility.
NOTE:
One bug I just found in the Magic v9.3 SP5 DDF Make utility involves the Index Modifiable flag, specifically, Magic's DDF Make utility flags an index in the DDFs as being NOT modifiable when, in fact, the index IS modifiable. This inconsistency, of course, causes the PCC's Check Database wizard to fail the table definition. I traced this bug back to Magic's own Column Storage property called "Modifiable".
Now, this is an odd one and is going to take some time to describe, so please bear with me. There are three possibilities for the Column Property called Modifiable: two kinds of "Yes" and one kind of "No".
The first kind of Yes is the "default" Yes in which the word "Modifiable" and the word "Yes" appear in a normal font and color, and the little button icon displayed to the left of the word "Modifiable" contains a down-arrow and an 'x' - this indicates that the Column Property has not been changed from the default. When a Column's Modifiable property is this kind of Yes, Magic's DDF Make utility will flag any index in which this column participates as Modifiable = No and this is wrong.
The workaround is to change the "default" kind of Yes to the other kind of Yes by clicking the little button to the left of the word Modifiable. The icon then changes to a down-arrow and a plus sign (+), and the words change to a bold font and a different color (mine's blue as opposed to normal black). When a Column's Modifiable property is this kind of Yes, Magic's DDF Make utility will flag any index in which this column participates as Modifiable = Yes, and this is correct.
How To Modify an Existing Table Definition:
Magic's DDF Make utility is not able to modify existing table definitions, only to create new ones. So, if you've modified a table in the Table Repository and need to propagate this change into the DDFs, then here's how:
Step 1
Use the Pervasive Control Center to drop the subject table from the Data Dictionary. Right-click on the table name and select Delete from the context menu. In the Drop Table Wizard, make sure you UN-check the box labelled "Delete Data File" and then click Finish.
WARNING:
If you don't un-check the box labelled "Delete Data File" then, when you click Finish, the underlying data file will be physically deleted and your data will be gone.
Step 2
Copy the three DDFs named FILE.DDF, FIELD.DDF and INDEX.DDF from the directory in which your data files are stored to the directory in which your Magic executables are stored, overwriting the three files of the same names.
NOTE:
at this point, you should have four DDFs in the same directory as that in which your Magic executables are stored, as follows:
A) FILE.DDF Created by Pervasive.SQL
B) FIELD.DDF Created by Pervasive.SQL
C) FIELDEXT.DDF Created by Magic
D) INDEX.DDF Created by Pervasive.SQL
WARNING:
If FIELDEXT.DDF is no longer there, do NOT proceed. If you proceed without FIELDEXT.DDF, then Magic's DDF Make Utility will completely trash your DDFs and you'll have to start over again.
Step 3
In Magic, highlight the modified table in the Table Repository and press Ctrl+D or select Options | DDF Make from the pull down menus. This will create a new table definition in the DDFs for the subject table.
Step 4
Copy the three DDFs named FILE.DDF, FIELD.DDF and INDEX.DDF from the directory in which your Magic executables are stored to the directory in which your data files are stored, overwriting the three files of the same names.
Step 5
Run the PCC's Check Database wizard to check all of the table definitions for inconsistencies and correct any/all problems identified using the PCC's Table Designer utility.
Steve Blank