aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPFieldMapperController.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/SPFieldMapperController.m')
-rw-r--r--Source/SPFieldMapperController.m14
1 files changed, 9 insertions, 5 deletions
diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m
index b406f134..85caa27b 100644
--- a/Source/SPFieldMapperController.m
+++ b/Source/SPFieldMapperController.m
@@ -191,7 +191,7 @@ static NSString *SPTableViewSqlColumnID = @"sql";
showAdvancedView = NO;
targetTableHasPrimaryKey = NO;
- primaryKeyField = nil;
+ primaryKeyFields = nil;
heightOffset = 0;
[advancedReplaceView setHidden:YES];
[advancedUpdateView setHidden:YES];
@@ -224,7 +224,7 @@ static NSString *SPTableViewSqlColumnID = @"sql";
if (fieldMappingGlobalValues) [fieldMappingGlobalValues release];
if (fieldMappingGlobalValuesSQLMarked) [fieldMappingGlobalValuesSQLMarked release];
if (fieldMappingTableDefaultValues) [fieldMappingTableDefaultValues release];
- if (primaryKeyField) [primaryKeyField release];
+ if (primaryKeyFields) [primaryKeyFields release];
if (toBeEditedRowIndexes) [toBeEditedRowIndexes release];
[super dealloc];
}
@@ -565,8 +565,8 @@ static NSString *SPTableViewSqlColumnID = @"sql";
[fieldMappingTableDefaultValues addObject:@"0"];
}
targetTableHasPrimaryKey = YES;
- if (primaryKeyField) [primaryKeyField release];
- primaryKeyField = [[tableDetails objectForKey:@"primarykeyfield"] retain];
+ if (primaryKeyFields) [primaryKeyFields release];
+ primaryKeyFields = [[tableDetails objectForKey:@"primarykeyfield"] retain];
} else {
if([column objectForKey:@"unique"]) {
[type appendFormat:@",%@",@"UNIQUE"];
@@ -1246,7 +1246,11 @@ static NSString *SPTableViewSqlColumnID = @"sql";
[onupdateCheckBox setEnabled:NO];
[onupdateTextView setEditable:YES];
[onupdateTextView setSelectedRange:NSMakeRange(0,[[onupdateTextView string] length])];
- [onupdateTextView insertText:[NSString stringWithFormat:@"%@ = %@", [primaryKeyField backtickQuotedString], [primaryKeyField backtickQuotedString]]];
+ NSMutableArray *queryParts = [NSMutableArray arrayWithCapacity:[primaryKeyFields count]];
+ for (NSString *eachFieldName in primaryKeyFields) {
+ [queryParts addObject:[NSString stringWithFormat:@"%@ = %@", [eachFieldName backtickQuotedString], [eachFieldName backtickQuotedString]]];
+ }
+ [onupdateTextView insertText:[queryParts componentsJoinedByString:@" AND "]];
[onupdateTextView setBackgroundColor:[NSColor lightGrayColor]];
[onupdateTextView setEditable:NO];
} else {