Subject Re: [IBO] how to scan a database
Author Lucas Franzen
lastensegler@... schrieb:
>
> Hi,
> I intend to write a little program that scans a database on:
> - what tabels to exist (retrieving their names)
> - what fields exist in a existing tabel and so on....
>
> Since I am not very experienced in IBO I apreciate any help I can get.

You can use the IB_Connection.SchemaCache for this.

Have a look at the IB_WISQL (IBF_Query) how this is done in the Query
editor.

If you want to show all Tables in a Listbox you can use:

ListBoxTables.Items.Assign ( YOUR_IB_CONNECTION.SchemaCache.TableNames
);

and if you click on a certain item (table) in the listBox and want to
show all fields for this table in a second listBox you can use:

YOUR_IB_CONNECTION.SchemaCache.GetTableFields (
ListBoxTables.Items[ListBox.ItemIndex], ListBoxFields.Items );




If you do want to do it on your own, have a look at the system tables,
ie:

- RDB$RELATIONS

(RDB$RELATION_NAME contains the Tablenames, RDB$SYSTEM_FLAG states if it
is a system Table (Value '1'), or a userdefined table ('1'))

- RDB$RELATION_FIELDS

(RDB$FIELD_NAME contains the Fieldname,
RDB$RELATION_NAME the tablename the field belongs to,
RDB$FIELD_SOURCE the Domain,
etc...)


HTH
Luc.