|
|
| TSQL602Tables | Přehled CDK komponent | TSQL602ServerProps |
Zjednodušená deklarace třídy:
type TSQL602Indexes = class(TStringList) public property Connection : TComponent; property Application : string; property Table : string; property UniqueOnly : Boolean; function FindKey(Key : string) : TSQL602Index; end;
type TSQL602Index = class(TObject)
Name : string; // Jméno indexu
IndexType : TIndexType; // Typ indexu
Definition : string; // Definice indexu
end;
type TIndexType =
(
itPrimary = 1, // Primární klíč
itUnique = 2, // Unikátní index
itNonUnique = 3 // Neunikátní index
);
Připojení na SQL server, lze použít TSQL602Connection i TDBX602Connection.
Jméno databázové aplikace (schématu), do které tabulka patří. Není-li specifikováno, hledá se tabulka v aplikaci zadané v Connection.Application.
Jméno databázové tabulky, jejíž indexy má komponenta poskytnout. Povinný údaj.
Má-li hodnotu true, poskytne komponenta seznam pouze unikátních indexů, má-li hodnotu false (default), půjde o seznam všech indexů.
Vytvořit větev TreeView s indexy vybrané tabulky, podle typu indexu přiřadit jinou ikonu
procedure TMainForm.FillIndexes(N: TTreeNode);
var
IndexList : TSQL602Indexes;
i : integer;
TN : TTreeNode;
begin
IndexList := TSQL602Indexes.Create;
IndexList.Connection := SQL602Connection1;
IndexList.Table := N.Text;
for i := 0 to IndexList.Count - 1 do begin
TN := TreeView1.Items.AddChild(N.getFirstChild,IndexList.Strings[i]);
case TSQL602Index(IndexList.Objects[i]).IndexType of
itPrimary : TN.ImageIndex := 15;
itUnique : TN.ImageIndex := 14;
else TN.ImageIndex := 16;
end;
end;
IndexList.Free;
end;
| TSQL602Tables | Přehled CDK komponent | TSQL602ServerProps |