Extract database structure

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
flzanini
Posts: 17
Joined: Wed 29 Jul 2009 13:08

Extract database structure

Post by flzanini » Fri 17 Sep 2010 00:37

Hi all,

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

Best Regards.

AndreyZ

Post by AndreyZ » Fri 17 Sep 2010 06:54

Hello,

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

flzanini
Posts: 17
Joined: Wed 29 Jul 2009 13:08

Post by flzanini » Mon 20 Sep 2010 20:33

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?

AndreyZ

Post by AndreyZ » Tue 21 Sep 2010 08:04

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.

flzanini
Posts: 17
Joined: Wed 29 Jul 2009 13:08

Post by flzanini » Tue 21 Sep 2010 12:29

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.

AndreyZ

Post by AndreyZ » Tue 21 Sep 2010 14:03

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.

flzanini
Posts: 17
Joined: Wed 29 Jul 2009 13:08

Post by flzanini » Tue 21 Sep 2010 16:34

These components extract the database using a proprietary structure? I can't extract the database structure resulting a script?

AndreyZ

Post by AndreyZ » Wed 22 Sep 2010 07:40

You can't extract the database structure as a script. Currently IBDAC does not support this functionality.

Post Reply