KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Note: Generic Full Data Export-Import Routine
PRODUCT: 4D | VERSION: 2004 | PLATFORM: Mac & Win
Published On: February 17, 2006
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

This Tech Note introduces a generic 4D method which exports or imports a whole database in XML format, including pictures, BLOBs and subtables.

A full text export/import always proves useful for long-term archiving and to repair damaged data files. Exporting all data in text only mode and re-importing into a newly created data file guarantees a clean data and indexes. Besides, it produces a perfectly defragmented data file, which increases sequential access speed.

The sequence number for each table is automatically restored.

All the code is in a single method, this allows easy installation (copy&paste) into existing structures.

PLEASE NOTE: The ExportImport method was updated 04/30/09. Please download the Tech Note again to get the latest version.

Download Complete Tech Note and Example: Windows | Mac

Commented by Mehboob Alam on March 10, 2011 at 4:58 PM
Are there any notes on what was changed? Is this compatible with v12 and Unicode - it's still listed under v2004.
Commented by Jerome A Schuh on May 4, 2010 at 12:15 PM
I have moved this over to a V11 db. It runs very slowly because it is indexing as the data is being imported. Is there any simple way to turn off indexing when importing (Like you can with the import that 4D provides)?
Commented by Tim Penner on December 11, 2009 at 9:50 AM
When running this code please be aware that it is MUCH faster when ran Compiled versus Interpreted. For example i was exporting 2.6 GB of data in interpreted mode and after about 72 hours it had only completed about 2 GB of the data. I canceled the operation, compiled the structure, restarted compiled, and re-ran the export. The export finished all 2.6 GB of data within 3 hours.
Commented by Josh Fletcher on April 30, 2009 at 11:22 AM
The latest changes have been integrated into the Tech Note database, be sure to redownload the Tech Note to get the new version.
Commented by Brendan Coveney on April 30, 2009 at 8:13 AM
Thomas kindly updated the code so please use the code in the Updated Method.