diff options
author | drx777 <david.rekowski@gmx.de> | 2010-04-29 18:42:54 +0000 |
---|---|---|
committer | drx777 <david.rekowski@gmx.de> | 2010-04-29 18:42:54 +0000 |
commit | 6f6a32030c374acc5afd253bc3a8f6488d0b9433 (patch) | |
tree | 4d721f5155490f9bf9e0f9ee3cd3d64c41dd85cc /Source/TableDocument.m | |
parent | 230f6295f5c6a80201410bc0347e83920df08bfe (diff) | |
download | sequelpro-6f6a32030c374acc5afd253bc3a8f6488d0b9433.tar.gz sequelpro-6f6a32030c374acc5afd253bc3a8f6488d0b9433.tar.bz2 sequelpro-6f6a32030c374acc5afd253bc3a8f6488d0b9433.zip |
Only switch to the renamed/duplicated database name, if the action was successful. Caused an existing DB to be selected, after ren/dup failed because it exists.
Diffstat (limited to 'Source/TableDocument.m')
-rw-r--r-- | Source/TableDocument.m | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/Source/TableDocument.m b/Source/TableDocument.m index 7b5c3d2f..ea071365 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -4150,12 +4150,13 @@ BOOL copyWithContent = [copyOnlyStructureButton state] == NSOffState; - [dbActionCopy copyDatabaseFrom: [self database] - to: [databaseCopyNameField stringValue] - withContent: copyWithContent]; + if ([dbActionCopy copyDatabaseFrom: [self database] + to: [databaseCopyNameField stringValue] + withContent: copyWithContent]) { + [selectedDatabase release]; + selectedDatabase = [[NSString alloc] initWithString:[databaseCopyNameField stringValue]]; + } [dbActionCopy release]; - [selectedDatabase release]; - selectedDatabase = [[NSString alloc] initWithString:[databaseCopyNameField stringValue]]; [self setDatabases: self]; } @@ -4168,11 +4169,12 @@ [dbActionRename setConnection: [self getConnection]]; [dbActionRename setMessageWindow: tableWindow]; - [dbActionRename renameDatabaseFrom: [self database] - to: [databaseRenameNameField stringValue]]; + if ([dbActionRename renameDatabaseFrom: [self database] + to: [databaseRenameNameField stringValue]]) { + [selectedDatabase release]; + selectedDatabase = [[NSString alloc] initWithString:[databaseRenameNameField stringValue]]; + } [dbActionRename release]; - [selectedDatabase release]; - selectedDatabase = [[NSString alloc] initWithString:[databaseRenameNameField stringValue]]; [self setDatabases: self]; } |