From e08596ccfd20d826ce21256e6b41617814077e97 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Sat, 20 Feb 2010 17:53:02 +0000 Subject: =?UTF-8?q?=E2=80=A2=20applied=20new=20SPTableData=20keys=20"PRIMA?= =?UTF-8?q?RY"=20and=20"UNIQUE"=20information=20to=20the=20mapping=20table?= =?UTF-8?q?=20-=20set=20tokenField=20to=20noWrap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPFieldMapperController.m | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m index a44f5ca2..616497b4 100644 --- a/Source/SPFieldMapperController.m +++ b/Source/SPFieldMapperController.m @@ -218,10 +218,6 @@ if (tableDetails) { for (NSDictionary *column in [tableDetails objectForKey:@"columns"]) { [fieldMappingTableColumnNames addObject:[NSString stringWithString:[column objectForKey:@"name"]]]; - // if([column objectForKey:@"default"]) - // [fieldMappingTableDefaultValues addObject:[NSString stringWithString:[column objectForKey:@"default"]]]; - // else - // [fieldMappingTableDefaultValues addObject:@""]; NSMutableString *type = [NSMutableString string]; if([column objectForKey:@"type"]) [type appendString:[column objectForKey:@"type"]]; @@ -229,10 +225,16 @@ [type appendFormat:@"(%@)", [column objectForKey:@"length"]]; if([column objectForKey:@"values"]) [type appendFormat:@"(%@)", [[column objectForKey:@"values"] componentsJoinedByString:@"¦"]]; - if([column objectForKey:@"autoincrement"] && [[column objectForKey:@"autoincrement"] integerValue] == 1) - [type appendFormat:@",%@",@"PRIMARY KEY"]; - else if ([column objectForKey:@"default"]) - [type appendFormat:@",%@",[column objectForKey:@"default"]]; + + if([column objectForKey:@"isprimarykey"]) { + [type appendFormat:@",%@",@"PRIMARY"]; + } else { + if([column objectForKey:@"unique"]) + [type appendFormat:@",%@",@"UNIQUE"]; + if ([column objectForKey:@"default"]) + [type appendFormat:@",%@",[column objectForKey:@"default"]]; + } + [fieldMappingTableTypes addObject:[NSString stringWithString:type]]; } } @@ -612,8 +614,7 @@ if ([fieldMappingOperatorArray objectAtIndex:rowIndex] == doNotImport) return @""; if([NSArrayObjectAtIndex(fieldMappingArray, rowIndex) integerValue]>=[NSArrayObjectAtIndex(fieldMappingImportArray, 0) count]) - return [NSString stringWithFormat:@"%@: %@", NSLocalizedString(@"Global value", @"global value"), - NSArrayObjectAtIndex(fieldMappingGlobalValues, [NSArrayObjectAtIndex(fieldMappingArray, rowIndex) integerValue])]; + return [NSString stringWithFormat:@"%@: %@", NSLocalizedString(@"Global value", @"global value"), NSArrayObjectAtIndex(fieldMappingGlobalValues, [NSArrayObjectAtIndex(fieldMappingArray, rowIndex) integerValue])]; if(fieldMappingCurrentRow) return [NSString stringWithFormat:@"%@: %@", @@ -664,6 +665,7 @@ NSTokenFieldCell *b = [[[NSTokenFieldCell alloc] initTextCell:[fieldMappingTableTypes objectAtIndex:rowIndex]] autorelease]; [b setEditable:NO]; [b setAlignment:NSLeftTextAlignment]; + [b setWraps:NO]; [b setFont:[NSFont systemFontOfSize:9]]; [b setDelegate:self]; return b; -- cgit v1.2.3