aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPDotExporter.m4
-rw-r--r--Source/SPTableContent.m2
-rw-r--r--Source/SPTableData.m12
-rw-r--r--Source/SPTableRelations.m6
4 files changed, 16 insertions, 8 deletions
diff --git a/Source/SPDotExporter.m b/Source/SPDotExporter.m
index 62cfbc48..13bf13a5 100644
--- a/Source/SPDotExporter.m
+++ b/Source/SPDotExporter.m
@@ -175,10 +175,10 @@
}
// Get the column references. Currently the columns themselves are an array,
- // while reference columns and tables are comma separated if there are more than
+ // while tables are comma separated if there are more than
// one. Only use the first of each for the time being.
NSArray *originColumns = [constraint objectForKey:@"columns"];
- NSArray *referenceColumns = [[constraint objectForKey:@"ref_columns"] componentsSeparatedByString:@","];
+ NSArray *referenceColumns = [constraint objectForKey:@"ref_columns"];
NSString *extra = @"";
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index 85241ce2..7f9c172e 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -514,7 +514,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
for (NSDictionary *constraint in constraints)
{
NSString *firstColumn = [[constraint objectForKey:@"columns"] objectAtIndex:0];
- NSString *firstRefColumn = [[[constraint objectForKey:@"ref_columns"] componentsSeparatedByString:@","] objectAtIndex:0];
+ NSString *firstRefColumn = [[constraint objectForKey:@"ref_columns"] objectAtIndex:0];
NSUInteger columnIndex = [columnNames indexOfObject:firstColumn];
if (columnIndex != NSNotFound && ![[dataColumns objectAtIndex:columnIndex] objectForKey:@"foreignkeyreference"]) {
diff --git a/Source/SPTableData.m b/Source/SPTableData.m
index 311108f2..594d1df4 100644
--- a/Source/SPTableData.m
+++ b/Source/SPTableData.m
@@ -645,8 +645,16 @@
[fieldsParser setString:[[parts objectAtIndex:6] stringByTrimmingCharactersInSet:bracketSet]];
[constraintDetails setObject:[fieldsParser unquotedString] forKey:@"ref_table"];
- [fieldsParser setString:[[parts objectAtIndex:7] stringByTrimmingCharactersInSet:bracketSet]];
- [constraintDetails setObject:[fieldsParser unquotedString] forKey:@"ref_columns"];
+ NSMutableArray *refKeyColumns = [NSMutableArray array];
+ NSArray *refKeyColumnStrings = [[[parts objectAtIndex:7] stringByTrimmingCharactersInSet:bracketSet] componentsSeparatedByString:@","];
+
+ for (NSString *keyColumn in refKeyColumnStrings)
+ {
+ [fieldsParser setString:[[keyColumn stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] stringByTrimmingCharactersInSet:bracketSet]];
+ [refKeyColumns addObject:[fieldsParser unquotedString]];
+ }
+
+ [constraintDetails setObject:refKeyColumns forKey:@"ref_columns"];
NSUInteger nextOffs = 12;
diff --git a/Source/SPTableRelations.m b/Source/SPTableRelations.m
index 45450bf1..26ab8195 100644
--- a/Source/SPTableRelations.m
+++ b/Source/SPTableRelations.m
@@ -589,9 +589,9 @@ static NSString *SPRelationOnDeleteKey = @"on_delete";
{
[relationData addObject:[NSDictionary dictionaryWithObjectsAndKeys:
[constraint objectForKey:SPRelationNameKey], SPRelationNameKey,
- [[constraint objectForKey:SPRelationColumnsKey] objectAtIndex:0], SPRelationColumnsKey,
+ [[constraint objectForKey:SPRelationColumnsKey] componentsJoinedByCommas], SPRelationColumnsKey,
[constraint objectForKey:@"ref_table"], SPRelationFKTableKey,
- [constraint objectForKey:@"ref_columns"], SPRelationFKColumnsKey,
+ [[constraint objectForKey:@"ref_columns"] componentsJoinedByCommas], SPRelationFKColumnsKey,
([constraint objectForKey:@"update"] ? [constraint objectForKey:@"update"] : @""), SPRelationOnUpdateKey,
([constraint objectForKey:@"delete"] ? [constraint objectForKey:@"delete"] : @""), SPRelationOnDeleteKey,
nil]];
@@ -624,7 +624,7 @@ static NSString *SPRelationOnDeleteKey = @"on_delete";
[tableDataInstance resetAllData];
NSDictionary *tableInfo = [tableDataInstance informationForTable:table];
- NSArray *columns = [tableInfo objectForKey:SPRelationColumnsKey];
+ NSArray *columns = [tableInfo objectForKey:@"columns"];
NSMutableArray *validColumns = [NSMutableArray array];