FrontBase logo

FrontBase Documentation

FrontBase logo

Backtrack:
  Welcome!
    6. Original Documentation
Updated: 20-Nov-2000
prevnext
Table of Contents

6.15. Exporting Schema and Content

FrontBase allows you to export a complete database to flat-files. The SQL statement has the following syntax:

      WRITE ALL OUTPUT('<output directory>' [,'YES']);

All generated files will be saved in the specified output directory. The file called schema.sql contains the necessary SQL statements to recreate the database. If the 'YES' argument is supplied, a file for each base table is generated as well, holding the content data (rows) for the table. The schema.sql file will include the necessary import statements.

A flat-file holding the content data for a given table has the following lay-out:

      Line 1:   <schema name>.<table name>
      Line 2:   Column count
      Line 3:   <column #> <column name>,"~"
      Line 4:   ...
      Line n:   <column #> <column name>,"~\n"
        -- n-2 == column count
      Line n+1:	<row data>
      Line n+2:     -"-

Example:

A database with a single user (FB) and a single table T0 exported as:

      WRITE ALL * OUTPUT('/tmp/db5', 'YES');

/tmp/db5/schema.sql:

      CREATE USER "FB";
      CREATE SCHEMA "FB" AUTHORIZATION "FB"
      CREATE TABLE "T0"(
         "C0" INTEGER,
         "C1" INTEGER)

      ;
      COMMIT;

      SET SESSION AUTHORIZATION "FB";
      INSERT INTO "FB"."T0" FROM 'FrontBase' INPUT('/tmp/db5/2_13');
      COMMIT;

/tmp/db5/2_13:

      FB.T0
      2
        1 "C0","~"
        2 "C1","~\n"
      1~2~
      3~4~



If you have feedback or questions on this document, please send e-mail to doc-feedback@frontbase.com. Please reference the section number and topic. Thanks!!

©2000 FrontBase, Inc. All rights reserved.