aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTableStructureDelegate.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2012-06-04 08:18:06 +0000
committerstuconnolly <stuart02@gmail.com>2012-06-04 08:18:06 +0000
commit0cd4120577b6e970f3425c49346332388a3d2fd4 (patch)
tree1d67e97a9bbc37e98c8681c453b244eb96eb5c37 /Source/SPTableStructureDelegate.m
parent2852fbf643dc63dcec29da2fb9935239d97211cc (diff)
downloadsequelpro-0cd4120577b6e970f3425c49346332388a3d2fd4.tar.gz
sequelpro-0cd4120577b6e970f3425c49346332388a3d2fd4.tar.bz2
sequelpro-0cd4120577b6e970f3425c49346332388a3d2fd4.zip
More tidy up.
Diffstat (limited to 'Source/SPTableStructureDelegate.m')
-rw-r--r--Source/SPTableStructureDelegate.m35
1 files changed, 19 insertions, 16 deletions
diff --git a/Source/SPTableStructureDelegate.m b/Source/SPTableStructureDelegate.m
index 383a7474..4ca02803 100644
--- a/Source/SPTableStructureDelegate.m
+++ b/Source/SPTableStructureDelegate.m
@@ -47,40 +47,43 @@
// Return a placeholder if the table is reloading
if ((NSUInteger)rowIndex >= [tableFields count]) return @"...";
- if([[tableColumn identifier] isEqualToString:@"collation"]) {
+ if ([[tableColumn identifier] isEqualToString:@"collation"]) {
NSInteger idx = 0;
- if((idx = [[NSArrayObjectAtIndex(tableFields,rowIndex) objectForKey:@"encoding"] integerValue]) > 0 && idx < [encodingPopupCell numberOfItems]) {
+
+ if ((idx = [[NSArrayObjectAtIndex(tableFields, rowIndex) objectForKey:@"encoding"] integerValue]) > 0 && idx < [encodingPopupCell numberOfItems]) {
NSString *enc = [[encodingPopupCell itemAtIndex:idx] title];
- NSInteger start = [enc rangeOfString:@"("].location+1;
- NSInteger end = [enc length] - start - 1;
- collations = [databaseDataInstance getDatabaseCollationsForEncoding:[enc substringWithRange:NSMakeRange(start, end)]];
- } else {
+ NSUInteger start = [enc rangeOfString:@"("].location + 1;
+
+ collations = [databaseDataInstance getDatabaseCollationsForEncoding:[enc substringWithRange:NSMakeRange(start, [enc length] - start - 1)]];
+ }
+ else {
// If the structure has loaded (not still loading!) and the table encoding
// is set, use the appropriate collations.
- if([tableDocumentInstance structureLoaded] && [tableDataInstance tableEncoding] != nil) {
- collations = [databaseDataInstance getDatabaseCollationsForEncoding:[tableDataInstance tableEncoding]];
- } else {
- collations = [NSArray array];
- }
+ collations = ([tableDocumentInstance structureLoaded] && [tableDataInstance tableEncoding] != nil) ? [databaseDataInstance getDatabaseCollationsForEncoding:[tableDataInstance tableEncoding]] : [NSArray array];
}
[[tableColumn dataCell] removeAllItems];
if ([collations count] > 0) {
[[tableColumn dataCell] addItemWithTitle:@""];
+
// Populate collation popup button
for (NSDictionary *collation in collations)
+ {
[[tableColumn dataCell] addItemWithTitle:[collation objectForKey:@"COLLATION_NAME"]];
+ }
}
}
-
- else if([[tableColumn identifier] isEqualToString:@"Extra"]) {
+ else if ([[tableColumn identifier] isEqualToString:@"Extra"]) {
id dataCell = [tableColumn dataCell];
+
[dataCell removeAllItems];
+
// Populate Extra suggestion popup button
- for (id item in extraFieldSuggestions) {
- if(!(isCurrentExtraAutoIncrement && [item isEqualToString:@"auto_increment"])) {
+ for (id item in extraFieldSuggestions)
+ {
+ if (!(isCurrentExtraAutoIncrement && [item isEqualToString:@"auto_increment"])) {
[dataCell addItemWithObjectValue:item];
}
}
@@ -524,7 +527,7 @@
}
// 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"]){
+ else if ([[aTableColumn identifier] isEqualToString:@"collation"]) {
[aCell setEnabled:([fieldValidation isFieldTypeString:theRowType] && [[theRow objectForKey:@"binary"] integerValue] == 0 && ![theRowType hasSuffix:@"BINARY"] && ![theRowType hasSuffix:@"BLOB"])];
}