aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPDotExporter.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2011-10-08 19:17:34 +0000
committerstuconnolly <stuart02@gmail.com>2011-10-08 19:17:34 +0000
commit4f96895de524ea086d3ae1285fd89dfa53f86f54 (patch)
tree86d17f15bb96272ff84d17e182410475f49b6dee /Source/SPDotExporter.m
parentfbe0dde7445e36f058974ec0245076ed20974bd6 (diff)
downloadsequelpro-4f96895de524ea086d3ae1285fd89dfa53f86f54.tar.gz
sequelpro-4f96895de524ea086d3ae1285fd89dfa53f86f54.tar.bz2
sequelpro-4f96895de524ea086d3ae1285fd89dfa53f86f54.zip
Ensure the that table constraints are cleared in [SPTableData informationForTable:] to prevent the inclusion of them in subsequent calls for different tables. Fixes issue 1206.
Diffstat (limited to 'Source/SPDotExporter.m')
-rw-r--r--Source/SPDotExporter.m20
1 files changed, 13 insertions, 7 deletions
diff --git a/Source/SPDotExporter.m b/Source/SPDotExporter.m
index e0c1a294..cd00b61f 100644
--- a/Source/SPDotExporter.m
+++ b/Source/SPDotExporter.m
@@ -108,16 +108,16 @@
// Process the tables
for (NSUInteger i = 0; i < [[self dotExportTables] count]; i++)
{
-
// Check for cancellation flag
if ([self isCancelled]) {
[fkInfo release];
[pool release];
+
return;
}
NSString *tableName = NSArrayObjectAtIndex([self dotExportTables], i);
- NSString *tableLinkName = [self dotForceLowerTableNames]?[tableName lowercaseString]:tableName;
+ NSString *tableLinkName = [self dotForceLowerTableNames] ? [tableName lowercaseString] : tableName;
NSDictionary *tableInfo = [[self dotTableData] informationForTable:tableName];
// Set the current table
@@ -154,21 +154,24 @@
// Check if any relations are available for the table
NSArray *tableConstraints = [tableInfo objectForKey:@"constraints"];
+
if ([tableConstraints count]) {
- for (NSDictionary* aConstraint in tableConstraints) {
-
+
+ for (NSDictionary* constraint in tableConstraints)
+ {
// Check for cancellation flag
if ([self isCancelled]) {
[fkInfo release];
[pool release];
+
return;
}
// Get the column references. Currently the columns themselves are an array,
// while reference columns and tables are comma separated if there are more than
// one. Only use the first of each for the time being.
- NSArray *originColumns = [aConstraint objectForKey:@"columns"];
- NSArray *referenceColumns = [[aConstraint objectForKey:@"ref_columns"] componentsSeparatedByString:@","];
+ NSArray *originColumns = [constraint objectForKey:@"columns"];
+ NSArray *referenceColumns = [[constraint objectForKey:@"ref_columns"] componentsSeparatedByString:@","];
NSString *extra = @"";
@@ -176,12 +179,13 @@
extra = @" [ arrowhead=crow, arrowtail=odiamond ]";
}
- [fkInfo addObject:[NSString stringWithFormat:@"%@:%@ -> %@:%@ %@", tableLinkName, [originColumns objectAtIndex:0], [aConstraint objectForKey:@"ref_table"], [[referenceColumns objectAtIndex:0] lowercaseString], extra]];
+ [fkInfo addObject:[NSString stringWithFormat:@"%@:%@ -> %@:%@ %@", tableLinkName, [originColumns objectAtIndex:0], [constraint objectForKey:@"ref_table"], [[referenceColumns objectAtIndex:0] lowercaseString], extra]];
}
}
// Update progress
NSInteger progress = (i * ([self exportMaxProgress] / [[self dotExportTables] count]));
+
[self setExportProgressValue:progress];
[delegate performSelectorOnMainThread:@selector(dotExportProcessProgressUpdated:) withObject:self waitUntilDone:NO];
}
@@ -193,7 +197,9 @@
// Get the relations
for (id item in fkInfo)
+ {
[metaString appendFormat:@"%@;\n", item];
+ }
[fkInfo release];