aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/SPDatabaseData.m12
-rw-r--r--Source/SPExtendedTableInfo.m10
2 files changed, 18 insertions, 4 deletions
diff --git a/Source/SPDatabaseData.m b/Source/SPDatabaseData.m
index d7fa2eb8..cc782b5e 100644
--- a/Source/SPDatabaseData.m
+++ b/Source/SPDatabaseData.m
@@ -31,8 +31,8 @@
@interface SPDatabaseData (PrivateAPI)
- (NSArray *)_getDatabaseDataForQuery:(NSString *)query;
-
NSInteger _sortMySQL4CharsetEntry(NSDictionary *itemOne, NSDictionary *itemTwo, void *context);
+NSInteger _sortStorageEngineEntry(NSDictionary *itemOne, NSDictionary *itemTwo, void *context);
@end
@@ -228,7 +228,7 @@ NSInteger _sortMySQL4CharsetEntry(NSDictionary *itemOne, NSDictionary *itemTwo,
}
}
- return storageEngines;
+ return [storageEngines sortedArrayUsingFunction:_sortStorageEngineEntry context:nil];
}
/**
@@ -327,4 +327,12 @@ NSInteger _sortMySQL4CharsetEntry(NSDictionary *itemOne, NSDictionary *itemTwo,
return [[itemOne objectForKey:@"Charset"] compare:[itemTwo objectForKey:@"Charset"]];
}
+/**
+ * Sorts a storage engine array by the Engine key.
+ */
+NSInteger _sortStorageEngineEntry(NSDictionary *itemOne, NSDictionary *itemTwo, void *context)
+{
+ return [[itemOne objectForKey:@"Engine"] compare:[itemTwo objectForKey:@"Engine"]];
+}
+
@end
diff --git a/Source/SPExtendedTableInfo.m b/Source/SPExtendedTableInfo.m
index 89403615..23f3c426 100644
--- a/Source/SPExtendedTableInfo.m
+++ b/Source/SPExtendedTableInfo.m
@@ -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];