aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-08-10 13:10:39 +0000
committerBibiko <bibiko@eva.mpg.de>2010-08-10 13:10:39 +0000
commit9ea06fcd80d8f5f779a3e263ba7c605bb649ac15 (patch)
treedc16a2a4490910cf47eb4032efb40650fb77e87c
parenta5bf83e7db5c1d75a1a865e5e1e605ee08d0a507 (diff)
downloadsequelpro-9ea06fcd80d8f5f779a3e263ba7c605bb649ac15.tar.gz
sequelpro-9ea06fcd80d8f5f779a3e263ba7c605bb649ac15.tar.bz2
sequelpro-9ea06fcd80d8f5f779a3e263ba7c605bb649ac15.zip
• remember user's last setting for "Resetting AUTO_INC" while deletion of all rows in a table
-rw-r--r--Resources/Plists/PreferenceDefaults.plist2
-rw-r--r--Source/SPConstants.h1
-rw-r--r--Source/SPConstants.m3
-rw-r--r--Source/SPTableContent.m12
4 files changed, 13 insertions, 5 deletions
diff --git a/Resources/Plists/PreferenceDefaults.plist b/Resources/Plists/PreferenceDefaults.plist
index e501fae8..0fc3adc8 100644
--- a/Resources/Plists/PreferenceDefaults.plist
+++ b/Resources/Plists/PreferenceDefaults.plist
@@ -167,5 +167,7 @@
<integer>0</integer>
<key>FavoritesSortedInReverse</key>
<false/>
+ <key>ResetAutoIncrementAfterDeletionOfAllRows</key>
+ <true/>
</dict>
</plist>
diff --git a/Source/SPConstants.h b/Source/SPConstants.h
index 3ba923ff..69efe326 100644
--- a/Source/SPConstants.h
+++ b/Source/SPConstants.h
@@ -304,6 +304,7 @@ extern NSString *SPProcessListAutoRrefreshInterval;
extern NSString *SPFavoritesSortedBy;
extern NSString *SPFavoritesSortedInReverse;
extern NSString *SPAlwaysShowWindowTabBar;
+extern NSString *SPResetAutoIncrementAfterDeletionOfAllRows;
// Hidden Prefs
extern NSString *SPPrintWarningRowLimit;
diff --git a/Source/SPConstants.m b/Source/SPConstants.m
index 36a9a25b..cb5ea82f 100644
--- a/Source/SPConstants.m
+++ b/Source/SPConstants.m
@@ -134,7 +134,8 @@ NSString *SPProcessListEnableAutoRefresh = @"ProcessListEnableAutoRefres
NSString *SPProcessListAutoRrefreshInterval = @"ProcessListAutoRrefreshInterval";
NSString *SPFavoritesSortedBy = @"FavoritesSortedBy";
NSString *SPFavoritesSortedInReverse = @"FavoritesSortedInReverse";
-NSString *SPAlwaysShowWindowTabBar = @"WindowAlwaysShowTabBar";
+NSString *SPAlwaysShowWindowTabBar = @"WindowAlwaysShowTabBar";
+NSString *SPResetAutoIncrementAfterDeletionOfAllRows = @"ResetAutoIncrementAfterDeletionOfAllRows";
// Hidden Prefs
NSString *SPPrintWarningRowLimit = @"PrintWarningRowLimit";
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index 15f4df31..bf03c66e 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -1417,7 +1417,7 @@
// 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:NSOnState];
+ [[alert suppressionButton] setState:([prefs boolForKey:SPResetAutoIncrementAfterDeletionOfAllRows]) ? NSOnState : 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")];
@@ -1453,7 +1453,7 @@
// Order out current sheet to suppress overlapping of sheets
[[alert window] orderOut:nil];
- if ( [contextInfo isEqualToString:@"removeallrows"] ) {
+ if ( [contextInfo isEqualToString:@"removeallrows"] ) {
if ( returnCode == NSAlertDefaultReturn ) {
//check if the user is currently editing a row
if (isEditingRow) {
@@ -1461,15 +1461,19 @@
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;
+ currentlyEditingRow = -1;
}
[mySQLConnection queryString:[NSString stringWithFormat:@"DELETE FROM %@", [selectedTable backtickQuotedString]]];
if ( ![mySQLConnection queryErrored] ) {
// Reset auto increment if suppression button was ticked
- if([[alert suppressionButton] state] == NSOnState)
+ if([[alert suppressionButton] state] == NSOnState) {
[tableSourceInstance setAutoIncrementTo:@"1"];
+ [prefs setBool:YES forKey:SPResetAutoIncrementAfterDeletionOfAllRows];
+ } else {
+ [prefs setBool:NO forKey:SPResetAutoIncrementAfterDeletionOfAllRows];
+ }
[self reloadTable:self];