From f5a3d168c641c299f56ec613f8eb63cbc8e0c14e Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 20 Nov 2015 01:21:02 +0100 Subject: Hand ServerSupport instance to exporters --- Source/SPDatabaseDocument.m | 1 + Source/SPExportController.h | 5 ++++- Source/SPExportController.m | 2 ++ Source/SPExportInitializer.m | 3 ++- Source/SPExporter.h | 8 +++++++- Source/SPExporter.m | 2 ++ 6 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index a5202f05..3542a269 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -549,6 +549,7 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0; [tableDumpInstance setConnection:mySQLConnection]; #ifndef SP_CODA [exportControllerInstance setConnection:mySQLConnection]; + [exportControllerInstance setServerSupport:serverSupport]; #endif [tableDataInstance setConnection:mySQLConnection]; [extendedTableInfoInstance setConnection:mySQLConnection]; diff --git a/Source/SPExportController.h b/Source/SPExportController.h index f94596ca..bef547d8 100644 --- a/Source/SPExportController.h +++ b/Source/SPExportController.h @@ -33,7 +33,8 @@ @class SPCustomQuery; @class SPTablesList; @class SPTableData; -@class SPMySQLConnection; +@class SPMySQLConnection; +@class SPServerSupport; /** * @class SPExportController SPExportController.h @@ -170,6 +171,7 @@ * Database connection */ SPMySQLConnection *connection; + SPServerSupport *serverSupport; /** * Concurrent operation queue @@ -249,6 +251,7 @@ * @property connection Database connection */ @property(readwrite, assign) SPMySQLConnection *connection; +@property(readwrite, assign) SPServerSupport *serverSupport; - (void)exportTables:(NSArray *)table asFormat:(SPExportType)format usingSource:(SPExportSource)source; - (void)openExportErrorsSheetWithString:(NSString *)errors; diff --git a/Source/SPExportController.m b/Source/SPExportController.m index 2439dd86..f5730da2 100644 --- a/Source/SPExportController.m +++ b/Source/SPExportController.m @@ -80,6 +80,7 @@ static const NSString *SPSQLExportDropEnabled = @"SQLExportDropEnabled"; @implementation SPExportController @synthesize connection; +@synthesize serverSupport = serverSupport; @synthesize exportToMultipleFiles; @synthesize exportCancelled; @@ -1074,6 +1075,7 @@ set_input: SPClear(exportFilename); SPClear(localizedTokenNames); SPClear(previousConnectionEncoding); + [self setServerSupport:nil]; [super dealloc]; } diff --git a/Source/SPExportInitializer.m b/Source/SPExportInitializer.m index 37f15ae9..045e5046 100644 --- a/Source/SPExportInitializer.m +++ b/Source/SPExportInitializer.m @@ -426,9 +426,10 @@ for (SPExporter *exporter in exporters) { [exporter setConnection:connection]; + [exporter setServerSupport:[self serverSupport]]; [exporter setExportOutputEncoding:[connection stringEncoding]]; [exporter setExportMaxProgress:(NSInteger)[exportProgressIndicator bounds].size.width]; - [exporter setExportUsingLowMemoryBlockingStreaming:[exportProcessLowMemoryButton state]]; + [exporter setExportUsingLowMemoryBlockingStreaming:([exportProcessLowMemoryButton state] == NSOnState)]; [exporter setExportOutputCompressionFormat:(SPFileCompressionFormat)[exportOutputCompressionFormatPopupButton indexOfSelectedItem]]; [exporter setExportOutputCompressFile:([exportOutputCompressionFormatPopupButton indexOfSelectedItem] != SPNoCompression)]; } diff --git a/Source/SPExporter.h b/Source/SPExporter.h index 4b5fc7e3..1ddb9a69 100644 --- a/Source/SPExporter.h +++ b/Source/SPExporter.h @@ -53,11 +53,12 @@ * explicity called. */ -@class SPMySQLConnection, SPExportFile; +@class SPMySQLConnection, SPExportFile, SPServerSupport; @interface SPExporter : NSOperation { SPMySQLConnection *connection; + SPServerSupport *serverSupport; double exportProgressValue; double exportMaxProgress; @@ -80,6 +81,11 @@ */ @property(readwrite, retain) SPMySQLConnection *connection; +/** + * @property serverSupport Information about the features supported by this mysql version + */ +@property(readwrite, retain) SPServerSupport *serverSupport; + /** * @property exportProgressValue The export's current progress value */ diff --git a/Source/SPExporter.m b/Source/SPExporter.m index db5cf809..dfd5b4fa 100644 --- a/Source/SPExporter.m +++ b/Source/SPExporter.m @@ -35,6 +35,7 @@ @implementation SPExporter @synthesize connection; +@synthesize serverSupport = serverSupport; @synthesize exportProgressValue; @synthesize exportProcessIsRunning; @synthesize exportUsingLowMemoryBlockingStreaming; @@ -105,6 +106,7 @@ { if (exportData) SPClear(exportData); if (connection) SPClear(connection); + [self setServerSupport:nil]; if (exportOutputFile) SPClear(exportOutputFile); [super dealloc]; -- cgit v1.2.3