aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorjakob <jakob@eggerapps.at>2010-04-19 21:26:14 +0000
committerjakob <jakob@eggerapps.at>2010-04-19 21:26:14 +0000
commitcf0ce7904972ba4144e1030c7b9331b119fc8f5d (patch)
treeb31ed2adce994c65c584d227523c956d4196288b /Source
parent8fc225e0d21bdf8fa2a1ff2da12b9e14512fe441 (diff)
downloadsequelpro-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')
-rw-r--r--Source/TableContent.m13
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] ) {