Convert database tree from TTreeView to TVirtualStringTree.

- Fixes bug #271 "F5 shortcut in database tree not working"
- Fullfills rfe #519 "Highlight selected item in tree view when focus is elsewhere"
- Fixes inconsistent expansion state of nodes after refreshing
- Fixes plus sign staying when a db node with 0 tables was selected
- Slightly enhances painting speed within the dbtree
- Removes temporary storage of a rightclicked node (DBRightClickSelectItem). VirtualTree handles its right clicked selection exactly like the left clicked one, which makes makes coding a bit cleaner as we can always use the selected item instead of hacking with the right and left clicked node. On the other side it removes a quite user friendly feature. Well, we can reimplement this feature later, though it's not user UNfriendly currently.
- Reasonably rename the StringList "OnlyDBs" to "DatabasesWanted" and "OnlyDBs2" to "Databases"
This commit is contained in:
Ansgar Becker
2008-06-13 23:05:51 +00:00
parent c265dd2f94
commit 41074d211e
13 changed files with 597 additions and 807 deletions

View File

@ -52,7 +52,6 @@ type
currentCollation,
currentAutoincrement : String;
public
DatabaseName,
TableName : String;
end;
@ -128,8 +127,6 @@ var
begin
// Fetch table properties
sql := 'SHOW TABLE STATUS ';
if DatabaseName <> '' then
sql := sql + ' FROM ' + Mainform.mask(DatabaseName)+' ';
sql := sql + 'LIKE '+esc(TableName);
ds := Mainform.Childwin.GetResults(sql);
@ -183,8 +180,6 @@ begin
// SQL preview
sql := 'SHOW CREATE TABLE ';
if DatabaseName <> '' then
sql := sql + Mainform.mask(DatabaseName)+'.';
sql := sql + Mainform.Childwin.mask(currentName);
SynMemoCreate.Lines.Text := Mainform.Childwin.GetVar( sql, 1 );
@ -278,8 +273,6 @@ begin
if currentName <> editName.Text then
begin
tmp := 'RENAME ';
if DatabaseName <> '' then
tmp := tmp + Mainform.mask(DatabaseName)+'.';
tmp := tmp + Mainform.mask(editName.Text);
AlterSpecs.Add( tmp );
end;
@ -306,16 +299,9 @@ begin
if AlterSpecs.Count > 0 then
begin
sql := 'ALTER TABLE ';
if DatabaseName <> '' then
sql := sql + Mainform.mask(DatabaseName)+'.';
sql := sql + Mainform.Childwin.mask(currentName) + ' ' + ImplodeStr(', ', AlterSpecs);
sql := 'ALTER TABLE ' + Mainform.Childwin.mask(currentName) + ' ' + ImplodeStr(', ', AlterSpecs);
try
Mainform.ChildWin.ExecUpdateQuery( sql );
if DatabaseName = '' then
Mainform.ChildWin.MenuRefreshClick( Sender )
else
Mainform.ChildWin.PopulateTreeTableList( Mainform.ChildWin.DBRightClickSelectedItem.Parent, True );
except
On E:Exception do
begin
@ -324,6 +310,7 @@ begin
ModalResult := mrNone;
end;
end;
Mainform.ChildWin.MenuRefreshClick( Sender )
end;
end;