Page 1 of 1

TUniMetaData - Find AutoIncrement fields

Posted: Fri 21 Jul 2017 14:58
by tkoscielski
With TUniMetaData, I have looked at all the information it provides for various MetaDataKind options for different database types. The one thing I am having a problem finding is auto increment fields.

Is this attribute easily defined or perhaps I need some help interpreting the data I am looking at.

Thank you.

Re: TUniMetaData - Find AutoIncrement fields

Posted: Mon 24 Jul 2017 11:30
by azyk
TUniMetaData does not provide metadata about autoincrement fields. You can use the following code to determine the autoincrement field in the dataset:

Code: Select all

uses 
  ..., DBAccess, CRAccess;
...
procedure TForm1.Button1Click(Sender: TObject);
var
  RecordSet: TCRRecordSet;
begin
  ...
  UniQuery1.SQL.Text := 'select * from emp';
  UniQuery1.Open;
  RecordSet := TDBAccessUtils.GetIRecordSet(UniQuery1);

  if RecordSet.IdentityField <> nil then
    ShowMessage('IdentityField=' + RecordSet.IdentityField.Name)
  else
    ShowMessage('No identity field');
end;
Alternatively, you can create SQL queries by yourself to get metadata for each Uni provider.

Re: TUniMetaData - Find AutoIncrement fields

Posted: Tue 25 Jul 2017 14:03
by tkoscielski
Thank you. I have actually decided to go the route of writing the SQL query for the meta data of each type to collect this info.