Hi... I have question...
I'm going to create some universal forms that feeds them selves with information from field metadata from database. Because my application connects to database through Internet and that connection are not reliable, I wouldn't like to send to many sql to database asking for data from rdb$tables.
My question is... is there any place that I can get information like field description / domain / null/not_null flag from?
regards
Mario
Field metadata
-
AndreyZ
Re: Field metadata
Hello,
You can obtain information about domain names and nullable flags from the TIBCFieldDesc class. Here is a code example:Note that to run this code, you should add the IBCClasses unit to the USES clause of your unit.
The testdomains table is the following table:, and TESTDM is the following domain:
You can also use the TIBCMetaData component to obtain different kinds of meta-information from the server. For more information, please read the IBDAC documentation.
You can obtain information about domain names and nullable flags from the TIBCFieldDesc class. Here is a code example:
Code: Select all
begin
IBCQuery1.Options.RequiredFields := True;
IBCQuery1.Options.SetDomainNames := True;
IBCQuery1.SQL.Text := 'select * from testdomains';
IBCQuery1.Open;
ShowMessage(TIBCFieldDesc(IBCQuery1.GetFieldDesc('id')).DomainName);
ShowMessage(BoolToStr(TIBCFieldDesc(IBCQuery1.GetFieldDesc('id')).Required, True));
ShowMessage(TIBCFieldDesc(IBCQuery1.GetFieldDesc('name')).DomainName);
ShowMessage(BoolToStr(TIBCFieldDesc(IBCQuery1.GetFieldDesc('name')).Required, True));
end;The testdomains table is the following table:
Code: Select all
CREATE TABLE TESTDOMAINS (
ID TESTDM PRIMARY KEY,
NAME VARCHAR(20)
);Code: Select all
CREATE DOMAIN TESTDM AS INTEGER;