aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTableStructureLoading.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2012-07-16 09:06:58 +0000
committerstuconnolly <stuart02@gmail.com>2012-07-16 09:06:58 +0000
commit1d287a60914e27503c9b6c7218600ca83cc8040b (patch)
tree4017776a56f5c1066c204b00929db88b1437a12b /Source/SPTableStructureLoading.m
parent4cd26629de78580fad186f0beeaa3c2ebcd1a374 (diff)
downloadsequelpro-1d287a60914e27503c9b6c7218600ca83cc8040b.tar.gz
sequelpro-1d287a60914e27503c9b6c7218600ca83cc8040b.tar.bz2
sequelpro-1d287a60914e27503c9b6c7218600ca83cc8040b.zip
Fix the display of the encoding and collation of fields that don't support them (introduced in r3708). This also fixes the issue of re-ordering non-string fields failing due to the encoding and collaction being included.
Diffstat (limited to 'Source/SPTableStructureLoading.m')
-rw-r--r--Source/SPTableStructureLoading.m18
1 files changed, 11 insertions, 7 deletions
diff --git a/Source/SPTableStructureLoading.m b/Source/SPTableStructureLoading.m
index 40b731a5..a30d7c63 100644
--- a/Source/SPTableStructureLoading.m
+++ b/Source/SPTableStructureLoading.m
@@ -148,8 +148,8 @@
NSString *collation = nil;
NSString *encoding = nil;
- if ([fieldValidation isFieldTypeString:type] || ![type hasSuffix:@"BINARY"] || ![type hasSuffix:@"BLOB"]) {
-
+ if ([fieldValidation isFieldTypeString:type] && ![type hasSuffix:@"BINARY"] && ![type hasSuffix:@"BLOB"]) {
+
collation = [theField objectForKey:@"collation"] ? [theField objectForKey:@"collation"] : [[tableDataInstance statusValues] objectForKey:@"collation"];
encoding = [theField objectForKey:@"encoding"] ? [theField objectForKey:@"encoding"] : [tableDataInstance tableEncoding];
@@ -214,21 +214,25 @@
[theField setObject:[NSString stringWithFormat:@"%@,%@", [theField objectForKey:@"length"], [theField objectForKey:@"decimals"]] forKey:@"length"];
// Normalize default
- if(![theField objectForKey:@"default"])
+ if (![theField objectForKey:@"default"]) {
[theField setObject:@"" forKey:@"default"];
- else if([[theField objectForKey:@"default"] isNSNull])
+ }
+ else if ([[theField objectForKey:@"default"] isNSNull]) {
[theField setObject:[prefs stringForKey:SPNullValue] forKey:@"default"];
+ }
// Init Extra field
[theField setObject:@"None" forKey:@"Extra"];
// Check for auto_increment and set Extra accordingly
- if([[theField objectForKey:@"autoincrement"] integerValue])
+ if ([[theField objectForKey:@"autoincrement"] integerValue]) {
[theField setObject:@"auto_increment" forKey:@"Extra"];
+ }
// For timestamps check to see whether "on update CURRENT_TIMESTAMP" and set Extra accordingly
- else if ([type isEqualToString:@"TIMESTAMP"] && [[theField objectForKey:@"onupdatetimestamp"] integerValue])
+ else if ([type isEqualToString:@"TIMESTAMP"] && [[theField objectForKey:@"onupdatetimestamp"] integerValue]) {
[theField setObject:@"on update CURRENT_TIMESTAMP" forKey:@"Extra"];
+ }
}
// Set up the table details for the new table, and request an data/interface update
@@ -274,7 +278,7 @@
*
* Should be called on the main thread.
*/
-- (void) setTableDetails:(NSDictionary *)tableDetails
+- (void)setTableDetails:(NSDictionary *)tableDetails
{
NSString *newTableName = [tableDetails objectForKey:@"name"];
NSMutableDictionary *newDefaultValues;