diff options
author | stuconnolly <stuart02@gmail.com> | 2012-07-04 09:22:37 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2012-07-04 09:22:37 +0000 |
commit | 2a81ccd4c2047179d572019bb7c1158481c7810d (patch) | |
tree | 65707ddb5fa652405393233869e3fd4a9f839709 /Source/SPDatabaseData.m | |
parent | ac7800cfb9b47acbfd6b7fcca9f981d3f1e70808 (diff) | |
download | sequelpro-2a81ccd4c2047179d572019bb7c1158481c7810d.tar.gz sequelpro-2a81ccd4c2047179d572019bb7c1158481c7810d.tar.bz2 sequelpro-2a81ccd4c2047179d572019bb7c1158481c7810d.zip |
If available display the columns default encoding and collation in the structure view. Implements issue #1355.
Diffstat (limited to 'Source/SPDatabaseData.m')
-rw-r--r-- | Source/SPDatabaseData.m | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Source/SPDatabaseData.m b/Source/SPDatabaseData.m index 88f07e52..64a95c80 100644 --- a/Source/SPDatabaseData.m +++ b/Source/SPDatabaseData.m @@ -52,6 +52,7 @@ NSInteger _sortStorageEngineEntry(NSDictionary *itemOne, NSDictionary *itemTwo, { if ((self = [super init])) { characterSetEncoding = nil; + defaultCollation = nil; defaultCharacterSetEncoding = nil; collations = [[NSMutableArray alloc] init]; @@ -306,6 +307,26 @@ NSInteger _sortStorageEngineEntry(NSDictionary *itemOne, NSDictionary *itemTwo, } /** + * Returns the database's default collation. + * + * @return The default collation as a string + */ +- (NSString *)getDatabaseDefaultCollation +{ + if (!defaultCollation) { + [defaultCollation release]; + + SPMySQLResult *result = [connection queryString:@"SHOW VARIABLES LIKE 'collation_database'"]; + + [result setReturnDataAsStrings:YES]; + + defaultCollation = [[[result getRowAsDictionary] objectForKey:@"Value"] retain]; + } + + return defaultCollation; +} + +/** * Returns the database's default storage engine. * * @return The default storage engine as a string @@ -330,6 +351,7 @@ NSInteger _sortStorageEngineEntry(NSDictionary *itemOne, NSDictionary *itemTwo, // 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"] retain]; @@ -352,6 +374,7 @@ NSInteger _sortStorageEngineEntry(NSDictionary *itemOne, NSDictionary *itemTwo, if ([connection queryErrored]) return [NSArray array]; [result setReturnDataAsStrings:YES]; + return [result getAllRows]; } @@ -381,6 +404,7 @@ NSInteger _sortStorageEngineEntry(NSDictionary *itemOne, NSDictionary *itemTwo, { if (characterSetEncoding) [characterSetEncoding release], characterSetEncoding = nil; if (defaultCharacterSetEncoding) [defaultCharacterSetEncoding release], defaultCharacterSetEncoding = nil; + if (defaultCollation) [defaultCollation release], defaultCollation = nil; [collations release], collations = nil; [characterSetCollations release], characterSetCollations = nil; |