diff options
author | jakob <jakob@eggerapps.at> | 2010-04-19 21:26:14 +0000 |
---|---|---|
committer | jakob <jakob@eggerapps.at> | 2010-04-19 21:26:14 +0000 |
commit | cf0ce7904972ba4144e1030c7b9331b119fc8f5d (patch) | |
tree | b31ed2adce994c65c584d227523c956d4196288b /Source/TableContent.m | |
parent | 8fc225e0d21bdf8fa2a1ff2da12b9e14512fe441 (diff) | |
download | sequelpro-cf0ce7904972ba4144e1030c7b9331b119fc8f5d.tar.gz sequelpro-cf0ce7904972ba4144e1030c7b9331b119fc8f5d.tar.bz2 sequelpro-cf0ce7904972ba4144e1030c7b9331b119fc8f5d.zip |
- more fixing of issue 641. I forgot to consider the case of deleting the last row in the table
Diffstat (limited to 'Source/TableContent.m')
-rw-r--r-- | Source/TableContent.m | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Source/TableContent.m b/Source/TableContent.m index d4676243..ec6b9ec8 100644 --- a/Source/TableContent.m +++ b/Source/TableContent.m @@ -1402,7 +1402,7 @@ NSString *contextInfo = @"removerow"; - if (([tableContentView numberOfSelectedRows] == [tableContentView numberOfRows]) && !isFiltered && !isLimited && !isInterruptedLoad) { + if (([tableContentView numberOfSelectedRows] == [tableContentView numberOfRows]) && !isFiltered && !isLimited && !isInterruptedLoad && !isEditingNewRow) { contextInfo = @"removeallrows"; @@ -2164,8 +2164,17 @@ currentlyEditingRow = -1; } [tableContentView reloadData]; - } else if ( [contextInfo isEqualToString:@"removeallrows"] ) { + } else if ( [contextInfo isEqualToString:@"removeallrows"] ) { if ( returnCode == NSAlertDefaultReturn ) { + //check if the user is currently editing a row + if (isEditingRow) { + //cancel the edit + isEditingRow = NO; + // in case the delete fails, make sure we at least stay in a somewhat consistent state + [tableValues replaceRowAtIndex:currentlyEditingRow withRowContents:oldRow]; + currentlyEditingRow = -1; + } + [mySQLConnection queryString:[NSString stringWithFormat:@"DELETE FROM %@", [selectedTable backtickQuotedString]]]; if ( ![mySQLConnection queryErrored] ) { |