aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPDatabaseDocument.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2012-06-10 09:25:14 +0000
committerstuconnolly <stuart02@gmail.com>2012-06-10 09:25:14 +0000
commite4afd6305a2e4a5f57987c4aa7938d2ba20f5676 (patch)
tree87cfe84c9df5d562b74e0b474d2c153287a98f1c /Source/SPDatabaseDocument.m
parent638dcc0e4bc3038224e9921547f4c00a36837f56 (diff)
downloadsequelpro-e4afd6305a2e4a5f57987c4aa7938d2ba20f5676.tar.gz
sequelpro-e4afd6305a2e4a5f57987c4aa7938d2ba20f5676.tar.bz2
sequelpro-e4afd6305a2e4a5f57987c4aa7938d2ba20f5676.zip
Add the default encoding and storage engine to the default menu items on the new table sheet. Implements issue #1245.
Diffstat (limited to 'Source/SPDatabaseDocument.m')
-rw-r--r--Source/SPDatabaseDocument.m24
1 files changed, 7 insertions, 17 deletions
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index f09a97da..4f4deaca 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -1567,8 +1567,7 @@ static NSString *SPRenameDatabaseAction = @"SPRenameDatabase";
nil];
NSString *mysqlEncoding = [translationMap valueForKey:[NSString stringWithFormat:@"%i", [encodingTag intValue]]];
- if (!mysqlEncoding)
- return @"utf8";
+ if (!mysqlEncoding) return @"utf8";
return mysqlEncoding;
}
@@ -1588,30 +1587,21 @@ static NSString *SPRenameDatabaseAction = @"SPRenameDatabase";
*/
- (void)detectDatabaseEncoding
{
- SPMySQLResult *charSetResult;
- NSString *mysqlEncoding = nil;
-
_supportsEncoding = YES;
- // MySQL >= 4.1
- if ([serverSupport supportsCharacterSetDatabaseVar]) {
- charSetResult = [mySQLConnection queryString:@"SHOW VARIABLES LIKE 'character_set_database'"];
- [charSetResult setReturnDataAsStrings:YES];
- mysqlEncoding = [[charSetResult getRowAsDictionary] objectForKey:@"Value"];
- }
- // MySQL 4.0 or older -> only default character set possible, cannot choose others using "set names xy"
- else {
- mysqlEncoding = [[[mySQLConnection queryString:@"SHOW VARIABLES LIKE 'character_set'"] getRowAsDictionary] objectForKey:@"Value"];
- }
+ NSString *mysqlEncoding = [databaseDataInstance getDatabaseDefaultCharacterSet];
[selectedDatabaseEncoding release];
// Fallback or older version? -> set encoding to mysql default encoding latin1
- if ( !mysqlEncoding ) {
+ if (!mysqlEncoding) {
NSLog(@"Error: no character encoding found, mysql version is %@", [self mySQLVersion]);
+
selectedDatabaseEncoding = [[NSString alloc] initWithString:@"latin1"];
+
_supportsEncoding = NO;
- } else {
+ }
+ else {
selectedDatabaseEncoding = [mysqlEncoding retain];
}
}