aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPDatabaseData.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2012-06-18 23:39:43 +0000
committerrowanbeentje <rowan@beent.je>2012-06-18 23:39:43 +0000
commita395fa908f4ce95355e7e6aaf1d31a75ee3e31f5 (patch)
treecf919cf4a144861c9df184a51b157c803b633a88 /Source/SPDatabaseData.m
parenta2e45fab9cd07ffd95d24e96a33a922bb70f5c2f (diff)
downloadsequelpro-a395fa908f4ce95355e7e6aaf1d31a75ee3e31f5.tar.gz
sequelpro-a395fa908f4ce95355e7e6aaf1d31a75ee3e31f5.tar.bz2
sequelpro-a395fa908f4ce95355e7e6aaf1d31a75ee3e31f5.zip
Improvements to the New Table sheet:
- Make the default sheet width wider - Change "Default" encoding to "Inherit from database" to clarify the action of the menu item - Fix retrieval of default table type on recent MySQL versions - Fix retain of default server table type This should address Issue #1377.
Diffstat (limited to 'Source/SPDatabaseData.m')
-rw-r--r--Source/SPDatabaseData.m21
1 files changed, 16 insertions, 5 deletions
diff --git a/Source/SPDatabaseData.m b/Source/SPDatabaseData.m
index 4c99b97e..88f07e52 100644
--- a/Source/SPDatabaseData.m
+++ b/Source/SPDatabaseData.m
@@ -315,13 +315,24 @@ NSInteger _sortStorageEngineEntry(NSDictionary *itemOne, NSDictionary *itemTwo,
if (!defaultStorageEngine) {
[defaultStorageEngine release];
-
- // Use 'table_type' variable rather than 'storage_engine' as it's been available since MySQL 3.23.0
- SPMySQLResult *result = [connection queryString:@"SHOW VARIABLES LIKE 'table_type'"];
-
+
+ // Determine which variable to use based on server version. 'table_type' has been available since MySQL 3.23.0.
+ NSString *storageEngineKey = @"table_type";
+
+ // Post 5.5, storage_engine was deprecated; use default_storage_engine
+ if ([serverSupport isEqualToOrGreaterThanMajorVersion:5 minor:5 release:0]) {
+ storageEngineKey = @"default_storage_engine";
+
+ // For the rest of 5.x, use storage_engine
+ } else if ([serverSupport isEqualToOrGreaterThanMajorVersion:5 minor:0 release:0]) {
+ storageEngineKey = @"storage_engine";
+ }
+
+ // Retrieve the corresponding value for the determined key, ensuring return as a string
+ SPMySQLResult *result = [connection queryString:[NSString stringWithFormat:@"SHOW VARIABLES LIKE %@", [storageEngineKey tickQuotedString]]];;
[result setReturnDataAsStrings:YES];
- defaultStorageEngine = [[result getRowAsDictionary] objectForKey:@"Value"];
+ defaultStorageEngine = [[[result getRowAsDictionary] objectForKey:@"Value"] retain];
}
return defaultStorageEngine;