Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
From an old Database to the new one.
Message
From
26/01/2004 16:38:20
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
26/01/2004 16:24:03
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00870772
Message ID:
00870781
Views:
19
I wrote a little program for this, but the code doesn't belong to me.

Briefly, do all your development in an empty version of the database: all tables have zero records.

To update the database structure, either for your development testing, or for the client, do an APPEND FROM for each table, into a copy of the empty database.

This will cause "trigger failed" if you copy the child table before the parent table, so you have to use ADBOBJECTS("RELATION") to get information on relations. You can ignore relations where the third character in the RI column is "I" (ignore).

What I have done is: Create a cursor from the ADBOBJECTS("relation") information. Create a cursor with table names. SCAN through the list of tables, postponing any records where the parent wasn't copied already (according to the information in the relations table). Once a table is copied, delete it from the "tables" table, and delete corresponding records from the "relations" table.

You need some additional considerations for added and deleted tables.

If you compare the structure of both tables and determine they are identical, you can make an OS-level COPY, which is much faster.

Your speed will increase tenfold if you omit RI checking during the APPEND FROM - plus, you ignore errors due to new rules; these are perhaps better checked with a separate program, anyway. You can do this (omit RI checking) if you use a substitute for the standard RI; I have used TaxRI successfully (search for "Builder" in the download section).


HTH,

Hilmar.

>VFP7
>
>I'd like to import the data from an older version of a database to the newer version.
>
>In the new version there could be new tables, new fields.
>
>Is there a utility somewhere that would let me do that or does anybody can share code or tricks to do that the most effective way?
>
>TIA
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform