aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPExtendedTableInfo.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2012-04-16 20:16:52 +0000
committerstuconnolly <stuart02@gmail.com>2012-04-16 20:16:52 +0000
commit4cad6f0e6e4fb497b480256c2abe3de34ebf225c (patch)
treeb66d6a72a1537cf98624acf3c685f1a4d916fd86 /Source/SPExtendedTableInfo.m
parent0d3b69f964a8d9d93ca794d457b461463f1ec95d (diff)
downloadsequelpro-4cad6f0e6e4fb497b480256c2abe3de34ebf225c.tar.gz
sequelpro-4cad6f0e6e4fb497b480256c2abe3de34ebf225c.tar.bz2
sequelpro-4cad6f0e6e4fb497b480256c2abe3de34ebf225c.zip
Bring outline view branch up to date with trunk.
Diffstat (limited to 'Source/SPExtendedTableInfo.m')
-rw-r--r--Source/SPExtendedTableInfo.m21
1 files changed, 14 insertions, 7 deletions
diff --git a/Source/SPExtendedTableInfo.m b/Source/SPExtendedTableInfo.m
index 9baaecab..23f3c426 100644
--- a/Source/SPExtendedTableInfo.m
+++ b/Source/SPExtendedTableInfo.m
@@ -33,7 +33,7 @@
#import "SPAlertSheets.h"
#import "SPTableStructure.h"
#import "SPServerSupport.h"
-#import "SPMySQL.h"
+#import <SPMySQL/SPMySQL.h>
static NSString *SPUpdateTableTypeCurrentType = @"SPUpdateTableTypeCurrentType";
static NSString *SPUpdateTableTypeNewType = @"SPUpdateTableTypeNewType";
@@ -90,12 +90,18 @@ static NSString *SPUpdateTableTypeNewType = @"SPUpdateTableTypeNewType";
// Check if the user selected the same type
if ([currentType isEqualToString:newType]) return;
-
+
+ // If the table is empty, perform the change directly
+ if ([[[tableDataInstance statusValues] objectForKey:@"Rows"] isEqualToString:@"0"]) {
+ [self _changeCurrentTableTypeFrom:currentType to:newType];
+ return;
+ }
+
NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Change table type", @"change table type message")
defaultButton:NSLocalizedString(@"Change", @"change button")
alternateButton:NSLocalizedString(@"Cancel", @"cancel button")
otherButton:nil
- informativeTextWithFormat:NSLocalizedString(@"Are you sure you want to change this table's type to %@?\n\nPlease be aware that changing a table's type has the potential to cause the loss of some or all of it's data. This action cannot be undone.", @"change table type informative message"), newType];
+ informativeTextWithFormat:NSLocalizedString(@"Are you sure you want to change this table's type to %@?\n\nPlease be aware that changing a table's type has the potential to cause the loss of some or all of its data. This action cannot be undone.", @"change table type informative message"), newType];
[alert setAlertStyle:NSCriticalAlertStyle];
@@ -610,16 +616,17 @@ static NSString *SPUpdateTableTypeNewType = @"SPUpdateTableTypeNewType";
if ([connection queryErrored]) {
- // Reload the table's data
- [tableDocumentInstance loadTable:selectedTable ofType:[tableDocumentInstance tableType]];
- }
- else {
[tableTypePopUpButton selectItemWithTitle:currentType];
SPBeginAlertSheet(NSLocalizedString(@"Error changing table type", @"error changing table type message"),
NSLocalizedString(@"OK", @"OK button"), nil, nil, [NSApp mainWindow], self, nil, nil,
[NSString stringWithFormat:NSLocalizedString(@"An error occurred when trying to change the table type to '%@'.\n\nMySQL said: %@", @"error changing table type informative message"), newType, [connection lastErrorMessage]]);
+
+ return;
}
+
+ // Reload the table's data
+ [tableDocumentInstance loadTable:selectedTable ofType:[tableDocumentInstance tableType]];
}
/**