aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPDotExporter.h11
-rw-r--r--Source/SPDotExporter.m6
-rw-r--r--Source/SPExportController.h8
-rw-r--r--Source/SPExportController.m18
-rw-r--r--Source/SPExportInitializer.m1
5 files changed, 38 insertions, 6 deletions
diff --git a/Source/SPDotExporter.h b/Source/SPDotExporter.h
index 5de22927..4a962c7b 100644
--- a/Source/SPDotExporter.h
+++ b/Source/SPDotExporter.h
@@ -42,9 +42,11 @@
NSArray *dotExportTables;
NSString *dotExportCurrentTable;
-
+
+ BOOL dotForceLowerTableNames;
+
SPTableData *dotTableData;
-
+
NSString *dotDatabaseHost;
NSString *dotDatabaseName;
NSString *dotDatabaseVersion;
@@ -66,6 +68,11 @@
@property(readwrite, retain) NSString *dotExportCurrentTable;
/**
+ * @property dotForceLowerTableNames dotForceLowerTableNames Force lowercase table names
+ */
+@property(readwrite, assign) BOOL dotForceLowerTableNames;
+
+/**
* @property dotTableData Table data
*/
@property(readwrite, retain) SPTableData *dotTableData;
diff --git a/Source/SPDotExporter.m b/Source/SPDotExporter.m
index 85b497e9..55ab645b 100644
--- a/Source/SPDotExporter.m
+++ b/Source/SPDotExporter.m
@@ -33,6 +33,7 @@
@synthesize delegate;
@synthesize dotExportTables;
@synthesize dotExportCurrentTable;
+@synthesize dotForceLowerTableNames;
@synthesize dotTableData;
@synthesize dotDatabaseHost;
@synthesize dotDatabaseName;
@@ -115,6 +116,7 @@
}
NSString *tableName = NSArrayObjectAtIndex([self dotExportTables], i);
+ NSString *tableLinkName = [self dotForceLowerTableNames]?[tableName lowercaseString]:tableName;
NSDictionary *tableInfo = [[self dotTableData] informationForTable:tableName];
// Set the current table
@@ -131,7 +133,7 @@
[metaString setString:[NSString stringWithFormat:@"\tsubgraph \"table_%@\" {\n", tableName]];
[metaString appendString:@"\t\tnode [ shape = \"plaintext\" ];\n"];
- [metaString appendFormat:@"\t\t\"%@\" [ label=<\n", tableName];
+ [metaString appendFormat:@"\t\t\"%@\" [ label=<\n", tableLinkName];
[metaString appendString:@"\t\t\t<TABLE BORDER=\"0\" CELLSPACING=\"0\" CELLBORDER=\"1\">\n"];
[metaString appendFormat:@"\t\t\t<TR><TD COLSPAN=\"3\" BGCOLOR=\"%@\">%@</TD></TR>\n", hdrColor, tableName];
@@ -173,7 +175,7 @@
extra = @" [ arrowhead=crow, arrowtail=odiamond ]";
}
- [fkInfo addObject:[NSString stringWithFormat:@"%@:%@ -> %@:%@ %@", tableName, [originColumns objectAtIndex:0], [aConstraint objectForKey:@"ref_table"], [referenceColumns objectAtIndex:0], extra]];
+ [fkInfo addObject:[NSString stringWithFormat:@"%@:%@ -> %@:%@ %@", tableLinkName, [originColumns objectAtIndex:0], [aConstraint objectForKey:@"ref_table"], [[referenceColumns objectAtIndex:0] lowercaseString], extra]];
}
}
diff --git a/Source/SPExportController.h b/Source/SPExportController.h
index 24c30b39..ff5c65ba 100644
--- a/Source/SPExportController.h
+++ b/Source/SPExportController.h
@@ -108,6 +108,9 @@
IBOutlet NSButton *exportXMLIncludeStructure;
IBOutlet NSButton *exportXMLIncludeContent;
IBOutlet NSTextField *exportXMLNULLValuesAsTextField;
+
+ // Dot
+ IBOutlet NSButton *exportDotForceLowerTableNamesCheck;
/**
* Cancellation flag
@@ -204,6 +207,11 @@
*/
BOOL sqlPreviousConnectionEncodingViaLatin1;
+ /**
+ * The server's lower_case_table_names setting
+ */
+ NSInteger serverLowerCaseTableNameValue;
+
NSInteger heightOffset1;
NSInteger heightOffset2;
NSUInteger windowMinWidth;
diff --git a/Source/SPExportController.m b/Source/SPExportController.m
index 755a4f74..1d70f88f 100644
--- a/Source/SPExportController.m
+++ b/Source/SPExportController.m
@@ -93,7 +93,8 @@ static const NSString *SPTableViewDropColumnID = @"drop";
showAdvancedView = NO;
showCustomFilenameView = NO;
-
+ serverLowerCaseTableNameValue = NSNotFound;
+
heightOffset1 = 0;
heightOffset2 = 0;
windowMinWidth = [[self window] minSize].width;
@@ -706,10 +707,23 @@ static const NSString *SPTableViewDropColumnID = @"drop";
// Set the tooltip
[[exportTableList tableColumnWithIdentifier:SPTableViewContentColumnID] setHeaderToolTip:(enable) ? @"" : NSLocalizedString(@"Include content", @"include content table column tooltip")];
+ // When switching to Dot export, ensure the server's lower_case_table_names value is checked the first time
+ // to set the export's link case sensitivity setting
+ if (isDot && serverLowerCaseTableNameValue == NSNotFound) {
+ MCPResult *caseResult = [connection queryString:@"SHOW VARIABLES LIKE 'lower_case_table_names'"];
+ [caseResult setReturnDataAsStrings:YES];
+ if ([caseResult numOfRows] == 1) {
+ serverLowerCaseTableNameValue = [[[caseResult fetchRowAsDictionary] objectForKey:@"Value"] integerValue];
+ } else {
+ serverLowerCaseTableNameValue = 0;
+ }
+ [exportDotForceLowerTableNamesCheck setState:(serverLowerCaseTableNameValue == 0)?NSOffState:NSOnState];
+ }
+
[exportCSVNULLValuesAsTextField setStringValue:[prefs stringForKey:SPNullValue]];
[exportXMLNULLValuesAsTextField setStringValue:[prefs stringForKey:SPNullValue]];
- [self _displayExportTypeOptions:(isSQL || isCSV || isXML)];
+ [self _displayExportTypeOptions:(isSQL || isCSV || isXML || isDot)];
[self updateAvailableExportFilenameTokens];
if (!showCustomFilenameView) [self updateDisplayedExportFilename];
diff --git a/Source/SPExportInitializer.m b/Source/SPExportInitializer.m
index 9544bf4b..db951b5f 100644
--- a/Source/SPExportInitializer.m
+++ b/Source/SPExportInitializer.m
@@ -353,6 +353,7 @@
SPDotExporter *dotExporter = [[SPDotExporter alloc] initWithDelegate:self];
[dotExporter setDotTableData:tableDataInstance];
+ [dotExporter setDotForceLowerTableNames:[exportDotForceLowerTableNamesCheck state]];
[dotExporter setDotDatabaseHost:[tableDocumentInstance host]];
[dotExporter setDotDatabaseName:[tableDocumentInstance database]];
[dotExporter setDotDatabaseVersion:[tableDocumentInstance mySQLVersion]];