diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-02-23 11:34:58 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-02-23 11:34:58 +0000 |
commit | b1d29fac626ddbdcfda3bc034861c3b22e39b548 (patch) | |
tree | 97af06ea1957c982cdc1ab942dd027407ad5d6a3 /Source/TableContent.m | |
parent | a24e9c697049bacb587835153e2ebb4764fff008 (diff) | |
download | sequelpro-b1d29fac626ddbdcfda3bc034861c3b22e39b548.tar.gz sequelpro-b1d29fac626ddbdcfda3bc034861c3b22e39b548.tar.bz2 sequelpro-b1d29fac626ddbdcfda3bc034861c3b22e39b548.zip |
• Reset AUTO_INCREMENT in Table Info Pane uses inline entering of the new value (no sheet)
• "Delete all records" confirmation sheet shows a checkbox "Reset AUTO_INCREMENT after deletion" if PRI key is given for that table
• minimized table data querying for auto_inc
• optimized auto_inc change notification
• if user changes tabVIew to Table Info Pane update data in beforehand
• TRUNCATE query updates auto_inc value as well in TABLE INFORMATION
Diffstat (limited to 'Source/TableContent.m')
-rw-r--r-- | Source/TableContent.m | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/Source/TableContent.m b/Source/TableContent.m index 3a736a90..fc12dccf 100644 --- a/Source/TableContent.m +++ b/Source/TableContent.m @@ -29,6 +29,7 @@ #import "TableContent.h" #import "TableDocument.h" +#import "TableSource.h" #import "SPTableInfo.h" #import "TablesList.h" #import "CMImageView.h" @@ -49,7 +50,6 @@ #import "SPNotLoaded.h" #import "SPConstants.h" #import "SPDataStorage.h" -#import "TableDocument.h" #import "SPAlertSheets.h" @implementation TableContent @@ -1386,13 +1386,25 @@ [[buttons objectAtIndex:0] setKeyEquivalent:@"d"]; [[buttons objectAtIndex:0] setKeyEquivalentModifierMask:NSCommandKeyMask]; [[buttons objectAtIndex:1] setKeyEquivalent:@"\r"]; - + + [alert setShowsSuppressionButton:NO]; + [[alert suppressionButton] setState:NSOffState]; + NSString *contextInfo = @"removerow"; if (([tableContentView numberOfSelectedRows] == [tableContentView numberOfRows]) && !isFiltered && !isLimited && !isInterruptedLoad) { - + contextInfo = @"removeallrows"; + // If table has PRIMARY KEY ask for resetting the auto increment after deletion if given + if(![[tableDataInstance statusValueForKey:@"Auto_increment"] isKindOfClass:[NSNull class]]) { + [alert setShowsSuppressionButton:YES]; + [[alert suppressionButton] setState:NSOffState]; + [[[alert suppressionButton] cell] setControlSize:NSSmallControlSize]; + [[[alert suppressionButton] cell] setFont:[NSFont systemFontOfSize:11]]; + [[alert suppressionButton] setTitle:NSLocalizedString(@"Reset AUTO_INCREMENT after deletion?", @"reset auto_increment after deletion of all rows message")]; + } + [alert setMessageText:NSLocalizedString(@"Delete all rows?", @"delete all rows message")]; [alert setInformativeText:NSLocalizedString(@"Are you sure you want to delete all the rows from this table? This action cannot be undone.", @"delete all rows informative message")]; } @@ -2139,7 +2151,13 @@ if ( returnCode == NSAlertDefaultReturn ) { [mySQLConnection queryString:[NSString stringWithFormat:@"DELETE FROM %@", [selectedTable backtickQuotedString]]]; if ( [[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) { + + // Reset auto increment if suppression button was ticked + if([[sheet suppressionButton] state] == NSOnState) + [tableSourceInstance setAutoIncrementTo:@"1"]; + [self reloadTable:self]; + } else { [self performSelector:@selector(showErrorSheetWith:) withObject:[NSArray arrayWithObjects:NSLocalizedString(@"Error", @"error"), |