![]() ![]() ![]() ![]() ![]() ![]() ![]() |
||
BDE API Examples (DbiOpenRintList)DbiOpenRintList creates a table listing the referential integrity links for a specified table, along with their descriptions.
Return all RI information in a list for the specified table.This example uses the following input:Procedure GetRintDesc(Table1, Memo1.Lines) procedure GetRintDesc(Table: TTable; Lines: TStrings);
var
hCur: hDBICur;
RIDesc: RINTDesc;
rslt: DBIResult;
B: Byte;
Temp: string;
begin
// Get a cursor to the RI information...
Check(DbiOpenRIntList(Table.DBHandle, PChar(Table.TableName), nil, hCur));
try
Lines.Clear;
Check(DbiSetToBegin(hCur));
rslt := DBIERR_NONE;
// While there are no errors, get RI information...
while rslt = DBIERR_NONE do
begin
// Get the next RI record...
rslt := DbiGetNextRecord(hCur, dbiNOLOCK, @RIDesc, nil);
if rslt <> DBIERR_EOF then
begin
// Make sure nothing out of the ordinary happened...
Check(rslt);
// Display information...
Lines.Add('RI Number: ' + IntToStr(RIDesc.iRintNum));
Lines.Add('RI Name: ' + RIDesc.szRintName);
case RIDesc.eType of
rintMASTER: Lines.Add('RI Type: MASTER');
rintDEPENDENT: Lines.Add('RI Type: DEPENDENT');
else
Lines.Add('RI Type: UNKNOWN');
end;
Lines.Add('RI Other Table Name: ' + RIDesc.szTblName);
case RIDesc.eModOp of
rintRESTRICT: Lines.Add('RI Modify Qualifier: RESTRICT');
rintCASCADE: Lines.Add('RI Modify Qualifier: CASCADE');
else
Lines.Add('RI Modify Qualifier: UNKNOWN');
end;
case RIDesc.eDelOp of
rintRESTRICT: Lines.Add('RI Delete Qualifier: RESTRICT');
rintCASCADE: Lines.Add('RI Delete Qualifier: CASCADE');
else
Lines.Add('RI Delete Qualifier: UNKNOWN');
end;
Lines.Add('RI Fields in Linking Key: ' + INtToStr(RIDesc.iFldCount));
Temp := '';
for B := 0 to RIDesc.iFldCount - 1 do
Temp := Temp + IntToStr(RIDesc.aiThisTabFld[B]) + ', ';
SetLength(Temp, Length(Temp) - 2);
Lines.Add('RI Key Field Numbers in Table: ' + Temp);
Temp := '';
for B := 0 to RIDesc.iFldCount - 1 do
Temp := Temp + IntToStr(RIDesc.aiOthTabFld[B]) + ', ';
SetLength(Temp, Length(Temp) - 2);
Lines.Add('RI Key Field Numbers in Other Table: ' + Temp);
Lines.Add('');
end;
end;
finally
// All information was retrieved, close the in-memory table...
Check(DbiCloseCursor(hCur));
end;
end;
| ||
|
DISCLAIMER: You have the right to use this technical information subject to the terms of the No-Nonsense License Statement that you received with the Borland product to which this information pertains. |
||
| Trademarks & Copyright © 1998 Borland International, Inc. | ||