Page 1 of 1

Extract database structure

Posted: Fri 17 Sep 2010 00:37
by flzanini
Hi all,

Can I extract the database structure using the Devart VCL components for Firebird? How to do this?

Best Regards.

Posted: Fri 17 Sep 2010 06:54
by AndreyZ
Hello,

You can use the TIBCMetaData component to extract database structure. For more information read IBDAC Reference Manual.

Posted: Mon 20 Sep 2010 20:33
by flzanini
I'm trying to find some examples of how to use this component, but the IBDAC manual have poor examples.

I need to extract all data of my database, like table structures, procedures, index, domains, etc.

There is an example of how to do this?

Posted: Tue 21 Sep 2010 08:04
by AndreyZ
You can view an example of the TIBCMetaData component usage here: http://www.devart.com/forums/viewtopic.php?t=18896
To retrieve another information of the database structure, please, look at the MetaDataKind property of the TIBCMetaData component. It's used to specify which kind of metainformation to show. If you want to see all fields available in the TIBCMetaData component, you can link it to the TDataSource and TDBGrid components.

Posted: Tue 21 Sep 2010 12:29
by flzanini
Previously I searched on the forum about this topic, but all I found were exemples of how to extract only the names of the database objects.

I wish to extract a script in sql format. After exported I should run this script and create my database.

Thank you for help.

Posted: Tue 21 Sep 2010 14:03
by AndreyZ
You can use the TIBCBackupService and TIBCRestoreService services to transfer your database.
Here an example of backing up of the database:

Code: Select all

  IBCBackupService.Database := 'path to database';
  IBCBackupService.BackupFile.Add('backup filename');
  IBCBackupService.Options := IBCBackupService.Options + [boMetadataOnly]; // this option you should use if you want to transfer just a structure of your database
  IBCBackupService.Attach;
  IBCBackupService.ServiceStart;
And here an example of restoring of the database:

Code: Select all

  IBCRestoreService.Database.Add('path to database');
  IBCRestoreService.BackupFile.Add('backup filename');
  IBCRestoreService.Attach;
  IBCRestoreService.ServiceStart;
For more information about this services, please, read IBDAC Reference Manual.

Posted: Tue 21 Sep 2010 16:34
by flzanini
These components extract the database using a proprietary structure? I can't extract the database structure resulting a script?

Posted: Wed 22 Sep 2010 07:40
by AndreyZ
You can't extract the database structure as a script. Currently IBDAC does not support this functionality.