diff options
author | rowanbeentje <rowan@beent.je> | 2010-12-05 00:40:09 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2010-12-05 00:40:09 +0000 |
commit | 5d61e164670c386e73de8903dace40802f00fc00 (patch) | |
tree | aeac970c32bc95ca0db8a6a8671a26d2cdb38bd7 /Source/SPExportController.m | |
parent | c84d39d22cdc466b6a3d0c0e71966d074789b090 (diff) | |
download | sequelpro-5d61e164670c386e73de8903dace40802f00fc00.tar.gz sequelpro-5d61e164670c386e73de8903dace40802f00fc00.tar.bz2 sequelpro-5d61e164670c386e73de8903dace40802f00fc00.zip |
Apply a tweaked version of a patch by Aaron Linville (http://www.linville.org/) to handle table linking in .dot exports on case-insensitive servers:
- Adds a new checkbox on the .dot export interface controlling the case sensitivty of link handling
- Improve .dot export to use lowercase link references when the option is enabled, fixing .dot exports of table relations of table names with uppercase characters on case-insensitive servers
- Check the server's case-sensitivity setting and use that to control the checkbox when using the export interface to select .dot export
This addresses Issue #920.
Diffstat (limited to 'Source/SPExportController.m')
-rw-r--r-- | Source/SPExportController.m | 18 |
1 files changed, 16 insertions, 2 deletions
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]; |