Registriert seit: 26. Aug 2004
Ort: Nebel auf Amrum
3.154 Beiträge
Delphi 7 Enterprise
|
Re: Tabellenpräfix auslesen
17. Sep 2008, 20:59
Delphi-Quellcode:
procedure GetTableNames(ADOConnection:TADOConnection; List: TStrings;
SystemTables: Boolean = false);
var DataSet:TADODataSet;
TypeField, NameField, SchemaField: TField;
TableType: string;
begin
DataSet:=TADODataSet.Create(nil);
try
ADOConnection.OpenSchema(siTables, EmptyParam, EmptyParam, DataSet);
TypeField := DataSet.FieldByName('TABLE_TYPE');
NameField := DataSet.FieldByName('TABLE_NAME');
SchemaField := DataSet.FieldByName('TABLE_SCHEMA');
List.BeginUpdate;
try
List.Clear;
while not DataSet.Eof do begin
TableType := TypeField.AsString;
if (TableType = 'TABLE')
or (TableType = 'VIEW')
or (SystemTables and (TableType = 'SYSTEM TABLE')) then
begin
List.Append(SchemaField.AsString + '.' + NameField.AsString);
end;
DataSet.Next;
end;
finally
List.EndUpdate;
end;
finally
DataSet.free;
end;
end;
|
|
Zitat
|