Enhancement: Only refresh table cache after renaming, don't refresh the listview. In any error case don't rename the list-item.

This commit is contained in:
Ansgar Becker
2007-07-14 19:03:59 +00:00
parent 0f00d4a3c8
commit 2f3bcd9e38

View File

@@ -3350,15 +3350,20 @@ begin
abort;
end;
end;
// rename table
ExecUpdateQuery( 'ALTER TABLE ' + mask(Item.Caption) + ' RENAME ' + mask(S) );
// Try to rename, on any error abort and don't rename ListItem
try
// rename table
ExecUpdateQuery( 'ALTER TABLE ' + mask(Item.Caption) + ' RENAME ' + mask(S), False );
except
abort;
end;
i := SynSQLSyn1.TableNames.IndexOf( Item.Caption );
if i > -1 then
SynSQLSyn1.TableNames[i] := S;
ActualTable := S;
RefreshActiveDbTableList;
ShowDBProperties(self);
// re-select same item
for i:=0 to ListTables.Items.Count-1 do
begin
@@ -3369,8 +3374,6 @@ begin
break;
end;
end;
// Important! Otherwise OnEdited refreshes list too:
abort;
end;