diff options
-rw-r--r-- | Source/SPDatabaseData.m | 18 | ||||
-rw-r--r-- | Source/SPExtendedTableInfo.m | 2 | ||||
-rw-r--r-- | Source/SPTableStructure.m | 2 | ||||
-rw-r--r-- | Source/SPTableStructureDelegate.m | 7 |
4 files changed, 10 insertions, 19 deletions
diff --git a/Source/SPDatabaseData.m b/Source/SPDatabaseData.m index f2ac6a85..558ab59a 100644 --- a/Source/SPDatabaseData.m +++ b/Source/SPDatabaseData.m @@ -321,9 +321,7 @@ NSInteger _sortStorageEngineEntry(NSDictionary *itemOne, NSDictionary *itemTwo, */ - (NSString *)getDatabaseDefaultCharacterSet { - if (!defaultCharacterSetEncoding) { - [defaultCharacterSetEncoding release]; - + if (!defaultCharacterSetEncoding) { NSString *variable = [serverSupport supportsCharacterSetAndCollationVars] ? @"character_set_database" : @"character_set"; defaultCharacterSetEncoding = [[self _getSingleVariableValue:variable] retain]; @@ -339,9 +337,7 @@ NSInteger _sortStorageEngineEntry(NSDictionary *itemOne, NSDictionary *itemTwo, */ - (NSString *)getDatabaseDefaultCollation { - if (!defaultCollation) { - [defaultCollation release]; - + if (!defaultCollation && [serverSupport supportsCharacterSetAndCollationVars]) { defaultCollation = [[self _getSingleVariableValue:@"collation_database"] retain]; } @@ -355,9 +351,7 @@ NSInteger _sortStorageEngineEntry(NSDictionary *itemOne, NSDictionary *itemTwo, */ - (NSString *)getServerDefaultCharacterSet { - if (!serverDefaultCharacterSetEncoding) { - [serverDefaultCharacterSetEncoding release]; - + if (!serverDefaultCharacterSetEncoding) { NSString *variable = [serverSupport supportsCharacterSetAndCollationVars] ? @"character_set_server" : @"character_set"; serverDefaultCharacterSetEncoding = [[self _getSingleVariableValue:variable] retain]; @@ -373,9 +367,7 @@ NSInteger _sortStorageEngineEntry(NSDictionary *itemOne, NSDictionary *itemTwo, */ - (NSString *)getServerDefaultCollation { - if (!serverDefaultCollation) { - [serverDefaultCollation release]; - + if (!serverDefaultCollation) { serverDefaultCollation = [[self _getSingleVariableValue:@"collation_server"] retain]; } @@ -390,8 +382,6 @@ NSInteger _sortStorageEngineEntry(NSDictionary *itemOne, NSDictionary *itemTwo, - (NSString *)getDatabaseDefaultStorageEngine { if (!defaultStorageEngine) { - - [defaultStorageEngine release]; // Determine which variable to use based on server version. 'table_type' has been available since MySQL 3.23.0. NSString *storageEngineKey = @"table_type"; diff --git a/Source/SPExtendedTableInfo.m b/Source/SPExtendedTableInfo.m index 83aa059c..91c51a36 100644 --- a/Source/SPExtendedTableInfo.m +++ b/Source/SPExtendedTableInfo.m @@ -592,7 +592,7 @@ static NSString *SPUpdateTableTypeNewType = @"SPUpdateTableTypeNewType"; [tableTypePopUpButton setEnabled:(!isSystemSchemaDb)]; } - if ([[databaseDataInstance getDatabaseCharacterSetEncodings] count] && [tableDataInstance tableEncoding]) { + if ([[databaseDataInstance getDatabaseCharacterSetEncodings] count] && [tableDataInstance tableEncoding] && [[tableDocumentInstance serverSupport] supportsPost41CharacterSetHandling]) { [tableEncodingPopUpButton setEnabled:(!isSystemSchemaDb)]; } diff --git a/Source/SPTableStructure.m b/Source/SPTableStructure.m index dd64fa21..ec6cadae 100644 --- a/Source/SPTableStructure.m +++ b/Source/SPTableStructure.m @@ -782,7 +782,7 @@ if ([fieldValidation isFieldTypeString:theRowType]) { // Add CHARSET NSString *fieldEncoding = @""; - if([[theRow objectForKey:@"encoding"] integerValue] > 0) { + if([[theRow objectForKey:@"encoding"] integerValue] > 0 && [[tableDocumentInstance serverSupport] supportsPost41CharacterSetHandling]) { NSString *enc = [[encodingPopupCell itemAtIndex:[[theRow objectForKey:@"encoding"] integerValue]] title]; NSInteger start = [enc rangeOfString:@"("].location+1; NSInteger end = [enc length] - start - 1; diff --git a/Source/SPTableStructureDelegate.m b/Source/SPTableStructureDelegate.m index 27a7cfe9..a9f2a949 100644 --- a/Source/SPTableStructureDelegate.m +++ b/Source/SPTableStructureDelegate.m @@ -38,6 +38,7 @@ #import "SPTableView.h" #import "SPTableFieldValidation.h" #import "SPTableStructureLoading.h" +#import "SPServerSupport.h" #import <SPMySQL/SPMySQL.h> @@ -310,7 +311,7 @@ NSString *fieldEncoding = @""; - if ([[originalRow objectForKey:@"encoding"] integerValue] > 0) { + if ([[originalRow objectForKey:@"encoding"] integerValue] > 0 && [[tableDocumentInstance serverSupport] supportsPost41CharacterSetHandling]) { NSString *enc = [[encodingPopupCell itemAtIndex:[[originalRow objectForKey:@"encoding"] integerValue]] title]; NSInteger start = [enc rangeOfString:@"("].location + 1; @@ -557,12 +558,12 @@ // Only string fields allow encoding settings if (([[aTableColumn identifier] isEqualToString:@"encoding"])) { - [aCell setEnabled:([fieldValidation isFieldTypeString:theRowType] && ![theRowType hasSuffix:@"BINARY"] && ![theRowType hasSuffix:@"BLOB"])]; + [aCell setEnabled:([fieldValidation isFieldTypeString:theRowType] && ![theRowType hasSuffix:@"BINARY"] && ![theRowType hasSuffix:@"BLOB"]) && [[tableDocumentInstance serverSupport] supportsPost41CharacterSetHandling]]; } // Only string fields allow collation settings and string field is not set to BINARY since BINARY sets the collation to *_bin else if ([[aTableColumn identifier] isEqualToString:@"collation"]) { - [aCell setEnabled:([fieldValidation isFieldTypeString:theRowType] && [[theRow objectForKey:@"binary"] integerValue] == 0 && ![theRowType hasSuffix:@"BINARY"] && ![theRowType hasSuffix:@"BLOB"])]; + [aCell setEnabled:([fieldValidation isFieldTypeString:theRowType] && [[theRow objectForKey:@"binary"] integerValue] == 0 && ![theRowType hasSuffix:@"BINARY"] && ![theRowType hasSuffix:@"BLOB"] && [[tableDocumentInstance serverSupport] supportsPost41CharacterSetHandling])]; } // Check if UNSIGNED and ZEROFILL is allowed |