type
FBRecord = Record
fFieldName : AnsiString;
fRelation : AnsiString;
fOwner : AnsiString;
fAliasName : AnsiString;
fTypeField : Cardinal;
fisNullable: Boolean;
fSubType : Integer;
fLengthByte: Cardinal;
fScale : Integer;
fCharSet : Cardinal;
fOffset : Cardinal;
fNullOffset: Cardinal;
end;
var
_outFBRecord : Array of FBRecord;
ty_count_in : cardinal;
master : IMaster ;
util : IUtil;
st : IStatus;
dpb : IXpbBuilder;
att : IAttachment;
tra : ITransaction;
stmt : IStatement;
outMetadata : IMessageMetadata;
begin
master := master_interface;
util := master.getUtilInterface;
st := master.getStatus;
dpb := util.getXpbBuilder(st, IXpbBuilder.DPB, nil, 0);
dpb.insertString(st,isc_dpb_set_db_charset,PAnsiChar('NONE'));
dpb.insertInt(st,isc_dpb_set_db_sql_dialect,3);
dpb.insertString(st, isc_dpb_user_name, PAnsiChar('SYSDBA'));
dpb.insertString(st, isc_dpb_password, PAnsiChar('masterkey'));
att := prov.attachDatabase(st,PAnsiChar('11.5.0.145/4050:/ssd3/FB5/asciidoc.fb5'), dpb.getBufferLength(st), dpb.getBuffer(st));
tra := att.startTransaction(st, 0, nil);
stmt := att.prepare(st, tra, 0, PAnsiChar(' select * from doc order by id optimize for fist rows ;'), 3, IStatement.PREPARE_PREFETCH_METADATA);
outMetadata := stmt.getOutputMetadata(st);
ty_count_in := outMetadata.getCount(st);
setlength(_outFBRecord, ty_count_in);
for i:=0 to ty_count_in-1 do
begin
_outFBRecord[i].fFieldName := outMetadata.getField(st,i);
_outFBRecord[i].fRelation := outMetadata.getRelation(st,i);
_outFBRecord[i].fOwner := outMetadata.getOwner(st,i);
_outFBRecord[i].fAliasName := outMetadata.getAlias(st,i);
_outFBRecord[i].fTypeField := outMetadata.getType(st,i);
_outFBRecord[i].fisNullable := outMetadata.isNullable(st,i);
_outFBRecord[i].fSubType := outMetadata.getSubType(st,i);
_outFBRecord[i].fLengthByte := outMetadata.getLength(st,i);
_outFBRecord[i].fScale := outMetadata.getScale(st,i);
_outFBRecord[i].fCharSet := outMetadata.getCharSet(st,i);
_outFBRecord[i].fOffset := outMetadata.getOffset(st,i);
_outFBRecord[i].fNullOffset := outMetadata.getNullOffset(st,i);
end;
....
end;