From 332c2308514c1c0fe839dd0124d90cd8d24fd9ef Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Mon, 26 Oct 2009 23:30:09 +0000 Subject: Minor export work. --- Source/SPCSVExporter.h | 2 +- Source/SPExportController.h | 4 ++++ Source/SPExportController.m | 19 ++++++++++++------- Source/SPExporter.m | 2 +- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Source/SPCSVExporter.h b/Source/SPCSVExporter.h index b0edc04e..5c78be04 100644 --- a/Source/SPCSVExporter.h +++ b/Source/SPCSVExporter.h @@ -31,7 +31,7 @@ @interface SPCSVExporter : SPExporter { // CSV data - NSArray *csvDataArray; + NSArray *csvDataArray; MCPStreamingResult *csvDataResult; // CSV options diff --git a/Source/SPExportController.h b/Source/SPExportController.h index 16d176b3..b1c50933 100644 --- a/Source/SPExportController.h +++ b/Source/SPExportController.h @@ -119,6 +119,10 @@ typedef NSUInteger SPExportSource; // Concurrent operation queue NSOperationQueue *operationQueue; + + // Table/export operation mapping + NSMutableDictionary *tableExportMapping; + } @property (readwrite, assign) BOOL exportCancelled; diff --git a/Source/SPExportController.m b/Source/SPExportController.m index 19d794ae..d7c0882f 100644 --- a/Source/SPExportController.m +++ b/Source/SPExportController.m @@ -34,7 +34,7 @@ @interface SPExportController (PrivateAPI) - (void)_initializeExportUsingSelectedOptions; -- (BOOL)_exportTables:(NSArray *)exportTables asType:(SPExportType)type; +- (BOOL)_exportTables:(NSArray *)exportTables asType:(SPExportType)type toMultipleFiles:(BOOL)multipleFiles; @end @@ -53,6 +53,7 @@ tables = [[NSMutableArray alloc] init]; operationQueue = [[NSOperationQueue alloc] init]; + tableExportMapping = [NSMutableDictionary dictionary]; } return self; @@ -336,7 +337,7 @@ break; case SP_TABLE_EXPORT: - [self _exportTables:exportTables asType:exportType]; + [self _exportTables:exportTables asType:exportType toMultipleFiles:[exportFilePerTableCheck state]]; break; } } @@ -345,15 +346,14 @@ * Exports the contents' of the supplied array of tables. Note that this method currently only supports * exporting in CSV and XML formats. */ -- (BOOL)_exportTables:(NSArray *)exportTables asType:(SPExportType)type +- (BOOL)_exportTables:(NSArray *)exportTables asType:(SPExportType)type toMultipleFiles:(BOOL)multipleFiles { NSUInteger i; NSMutableString *errors = [NSMutableString string]; - NSMutableString *infoString = [NSMutableString string]; NSDictionary *tableDetails; - NSStringEncoding encoding = [[self connection] encoding]; + //NSStringEncoding encoding = [[self connection] encoding]; // Reset the interface [exportProgressTitle setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Exporting %@", @"text showing that the application is importing a supplied format"), @"CSV"]]; @@ -384,12 +384,17 @@ options:NSLiteralSearch range:NSMakeRange(0, [csvLineEnd length])]; + NSUInteger tableCount = [exportTables count]; + + // If + if ((type == SP_CSV_EXPORT) && (!multipleFiles) && (tableCount > 1)) { + + } + /*if ([exportTables count] > 1) { [infoString setString:[NSString stringWithFormat:@"Host: %@ Database: %@ Generation Time: %@%@%@", [tableDocumentInstance host], [tableDocumentInstance database], [NSDate date], csvLineEnd, csvLineEnd]]; }*/ - - NSUInteger tableCount = [exportTables count]; // Loop through the tables for (i = 0 ; i < tableCount; i++) diff --git a/Source/SPExporter.m b/Source/SPExporter.m index a1fe448b..cf764b61 100644 --- a/Source/SPExporter.m +++ b/Source/SPExporter.m @@ -58,7 +58,7 @@ } /** - * + * Override NSOperation's main() method. This method should never be called as all subclasses should override it. */ - (void)main { -- cgit v1.2.3