diff options
author | stuconnolly <stuart02@gmail.com> | 2010-06-10 12:34:49 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2010-06-10 12:34:49 +0000 |
commit | bea411be2e4193e9488e6cc5fac30045f6fb7f82 (patch) | |
tree | 7c83a9f6a26e4d7689a3c0df04cd26d9591c2ec0 | |
parent | 8af7ab7046ab834bc392a0eb31128c7d0647fd53 (diff) | |
download | sequelpro-bea411be2e4193e9488e6cc5fac30045f6fb7f82.tar.gz sequelpro-bea411be2e4193e9488e6cc5fac30045f6fb7f82.tar.bz2 sequelpro-bea411be2e4193e9488e6cc5fac30045f6fb7f82.zip |
Exporter fixes:
- Correctly disable exporting custom query results as SQL and enable for all other formats.
- Fix CSV exports when exporting from a source other than the selected tables.
- Correctly export custom query results instead of all tables as a result of a missing IB connection.
-rw-r--r-- | Interfaces/English.lproj/DBView.xib | 10 | ||||
-rw-r--r-- | Source/SPExportController.m | 17 | ||||
-rw-r--r-- | Source/SPExportInitializer.m | 3 |
3 files changed, 19 insertions, 11 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib index 6e749548..71154cfb 100644 --- a/Interfaces/English.lproj/DBView.xib +++ b/Interfaces/English.lproj/DBView.xib @@ -16940,6 +16940,14 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> <int key="connectionID">7071</int> </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">customQueryInstance</string> + <reference key="source" ref="4626"/> + <reference key="destination" ref="601471102"/> + </object> + <int key="connectionID">7072</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -27496,7 +27504,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> </object> <nil key="sourceID"/> - <int key="maxID">7071</int> + <int key="maxID">7072</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> diff --git a/Source/SPExportController.m b/Source/SPExportController.m index bdd5f0e0..4efb54a0 100644 --- a/Source/SPExportController.m +++ b/Source/SPExportController.m @@ -307,7 +307,7 @@ // Determine what data to use (filtered result, custom query result or selected table(s)) for the export operation exportSource = (exportType == SPDotExport) ? SPTableExport : [exportInputPopUpButton indexOfSelectedItem]; - + // Determine the export type exportType = [sender tag]; @@ -322,7 +322,7 @@ BOOL isPDF = (exportType == SPPDFExport); BOOL isDot = (exportType == SPDotExport); - BOOL disable = (isCSV || isXML || isHTML || isPDF || isDot); + BOOL enable = (isCSV || isXML || isHTML || isPDF || isDot); [exportFilePerTableCheck setHidden:(isSQL || isDot)]; [exportTableList setEnabled:(!isDot)]; @@ -336,13 +336,13 @@ // Enable/disable the 'filtered result' and 'query result' options // Note that the result count check is always greater than one as the first row is always the field names - [[[exportInputPopUpButton menu] itemAtIndex:SPFilteredExport] setEnabled:((!disable) && ([[tableContentInstance currentResult] count] > 1))]; - [[[exportInputPopUpButton menu] itemAtIndex:SPQueryExport] setEnabled:((!disable) && ([[customQueryInstance currentResult] count] > 1))]; + [[[exportInputPopUpButton menu] itemAtIndex:SPFilteredExport] setEnabled:((enable) && ([[tableContentInstance currentResult] count] > 1))]; + [[[exportInputPopUpButton menu] itemAtIndex:SPQueryExport] setEnabled:((enable) && ([[customQueryInstance currentResult] count] > 1))]; - [[exportTableList tableColumnWithIdentifier:@"structure"] setHidden:(isSQL) ? (![exportSQLIncludeStructureCheck state]) : disable]; - [[exportTableList tableColumnWithIdentifier:@"drop"] setHidden:(isSQL) ? (![exportSQLIncludeDropSyntaxCheck state]) : disable]; + [[exportTableList tableColumnWithIdentifier:@"structure"] setHidden:(isSQL) ? (![exportSQLIncludeStructureCheck state]) : YES]; + [[exportTableList tableColumnWithIdentifier:@"drop"] setHidden:(isSQL) ? (![exportSQLIncludeDropSyntaxCheck state]) : YES]; - [[[exportTableList tableColumnWithIdentifier:@"content"] headerCell] setStringValue:(disable) ? @"" : @"C"]; + [[[exportTableList tableColumnWithIdentifier:@"content"] headerCell] setStringValue:(enable) ? @"" : @"C"]; [exportCSVNULLValuesAsTextField setStringValue:[prefs stringForKey:SPNullValue]]; [exportXMLNULLValuesAsTextField setStringValue:[prefs stringForKey:SPNullValue]]; @@ -358,6 +358,9 @@ { if ([sender isKindOfClass:[NSPopUpButton class]]) { + // Determine what data to use (filtered result, custom query result or selected table(s)) for the export operation + exportSource = (exportType == SPDotExport) ? SPTableExport : [exportInputPopUpButton indexOfSelectedItem]; + BOOL isSelectedTables = ([sender indexOfSelectedItem] == SPTableExport); [exportFilePerTableCheck setHidden:(!isSelectedTables) || (exportType == SPSQLExport)]; diff --git a/Source/SPExportInitializer.m b/Source/SPExportInitializer.m index 7a03c110..c0d6e043 100644 --- a/Source/SPExportInitializer.m +++ b/Source/SPExportInitializer.m @@ -467,9 +467,6 @@ // sure the table name is included to ensure the output files are unique. [exportFilename setString:([[exportCustomFilenameTokenField stringValue] rangeOfString:@"table" options:NSLiteralSearch].location == NSNotFound) ? [exportFilename stringByAppendingFormat:@"_%@", table] : exportFilename]; } - else { - [exportFilename setString:table]; - } fileHandle = [self getFileHandleForFilePath:[[exportPathField stringValue] stringByAppendingPathComponent:exportFilename]]; |