Subject | Re: [IBO] how to scan a database |
---|---|
Author | Lucas Franzen |
Post date | 2001-06-27T12:56:16Z |
lastensegler@... schrieb:
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.
>You can use the IB_Connection.SchemaCache for this.
> 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.
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.