diff options
Diffstat (limited to 'Source/SPFieldMapperController.m')
-rw-r--r-- | Source/SPFieldMapperController.m | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m index 374bd3dd..caa83f3e 100644 --- a/Source/SPFieldMapperController.m +++ b/Source/SPFieldMapperController.m @@ -447,13 +447,17 @@ static NSString *SPTableViewSqlColumnID = @"sql"; [createString appendFormat:@"CREATE TABLE %@ (\n", [[newTableNameTextField stringValue] backtickQuotedString]]; NSInteger columnIndex = 0; NSInteger numberOfColumns = [fieldMappingTableColumnNames count]; - for(columnIndex = 0; columnIndex < numberOfColumns; columnIndex++) { - // add to the new table only those fields which are markes as "Do Import" - if([fieldMappingOperatorArray objectAtIndex:columnIndex] == doImport) { - [createString appendFormat:@"\t%@ %@", [[fieldMappingTableColumnNames objectAtIndex:columnIndex] backtickQuotedString], [fieldMappingTableTypes objectAtIndex:columnIndex]]; - if(columnIndex < numberOfColumns-1) [createString appendString:@", \n"]; + NSMutableArray *columnDetails = [NSMutableArray array]; + for (columnIndex = 0; columnIndex < numberOfColumns; columnIndex++) { + + // Skip fields which aren't marked as imported + if ([fieldMappingOperatorArray objectAtIndex:columnIndex] != doImport) { + continue; } + + [columnDetails addObject:[NSString stringWithFormat:@"\t%@ %@", [[fieldMappingTableColumnNames objectAtIndex:columnIndex] backtickQuotedString], [fieldMappingTableTypes objectAtIndex:columnIndex]]]; } + [createString appendString:[columnDetails componentsJoinedByString:@", \n"]]; [createString appendString:@")"]; #ifndef SP_REFACTOR |