Do not fetch database objects from information_schema, which has gotten extremely slow on servers with many databases and triggers, since we support triggers.

* Instead, use separate SHOW commands for tables, functions, procedures and triggers
* Catch this chance to move these methods from main unit to mysql_connection, so they're accessible in a more generic way
* Additionally, introduce new classes TDBObject and TDBObjectList which provide a more generic way than TMySQLQuery to access these database objects.
Fixes issue #1529
This commit is contained in:
Ansgar Becker
2009-12-19 11:40:28 +00:00
parent dfa981232c
commit 35e8bbb304
12 changed files with 509 additions and 536 deletions

View File

@ -89,15 +89,15 @@ end;
{ Read tables from selected DB }
procedure TfrmInsertFiles.ComboBoxDBsChange(Sender: TObject);
var
Results: TMySQLQuery;
DBObjects: TDBObjectList;
i: Integer;
begin
// read tables from db
ComboBoxTables.Items.Clear;
Results := Mainform.FetchDbTableList(ComboBoxDBs.Text);
while not Results.Eof do begin
if GetDBObjectType(Results) in [lntTable, lntView] then
ComboBoxTables.Items.Add(Results.Col(DBO_NAME));
Results.Next;
DBObjects := Mainform.Connection.GetDBObjects(ComboBoxDBs.Text);
for i:=0 to DBObjects.Count-1 do begin
if DBObjects[i].NodeType in [lntTable, lntView] then
ComboBoxTables.Items.Add(DBObjects[i].Name);
end;
if ComboBoxTables.Items.Count > 0 then
ComboBoxTables.ItemIndex := 0;