aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPExporter.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2010-07-24 21:34:05 +0000
committerstuconnolly <stuart02@gmail.com>2010-07-24 21:34:05 +0000
commitbf1294bd1016672aa3062bb80b546bf2f8037fb3 (patch)
tree121768027638e59af7d5830855bd19b88de7e601 /Source/SPExporter.m
parenteb29a57a6860961c0caa00787d779f4cb4117c90 (diff)
downloadsequelpro-bf1294bd1016672aa3062bb80b546bf2f8037fb3.tar.gz
sequelpro-bf1294bd1016672aa3062bb80b546bf2f8037fb3.tar.bz2
sequelpro-bf1294bd1016672aa3062bb80b546bf2f8037fb3.zip
In addition to Gzip compression support when exporting SQL dumps add the ability to use Bzip2 compression.
Other changes include: + Enable the use of export compression (Gzip and Bzip2) for all export formats. + Move the compression options in the export dialog to the 'Advanced' export settings view. + Simplify the setting of common exporter properties (e.g. the connection, use of compression). + Fix a potential memory leak in the dot exporter. + Update the data importer to recognise Bzip2 compressed files. + Fix several display issues on export dialog. + Restore the default .csv file extension of CSV exports. + Correctly update the default export filename when selecting a output compression type. The addition of Bzip2 compression support implements issue #688.
Diffstat (limited to 'Source/SPExporter.m')
-rw-r--r--Source/SPExporter.m28
1 files changed, 26 insertions, 2 deletions
diff --git a/Source/SPExporter.m b/Source/SPExporter.m
index b7d9f242..cd45ec50 100644
--- a/Source/SPExporter.m
+++ b/Source/SPExporter.m
@@ -31,6 +31,7 @@
@synthesize exportProgressValue;
@synthesize exportProcessIsRunning;
@synthesize exportUsingLowMemoryBlockingStreaming;
+@synthesize exportOutputCompressionFormat;
@synthesize exportData;
@synthesize exportOutputFileHandle;
@synthesize exportOutputEncoding;
@@ -44,9 +45,11 @@
if ((self = [super init])) {
[self setExportProgressValue:0];
[self setExportProcessIsRunning:NO];
+ [self setExportOutputCompressFile:NO];
+ [self setExportOutputCompressionFormat:SPNoCompression];
// Default the resulting data to an empty string
- [self setExportData:@""];
+ [self setExportData:[NSString string]];
// Default the output encoding to UTF-8
[self setExportOutputEncoding:NSUTF8StringEncoding];
@@ -61,11 +64,32 @@
- (void)main
{
@throw [NSException exceptionWithName:@"NSOperation main() Call"
- reason:@"Can't call NSOperation's main() method in SPExpoter, must be overriden in subclass."
+ reason:@"Cannot call NSOperation's main() method in SPExpoter, must be overriden in a subclass. See SPExporter.h"
userInfo:nil];
}
/**
+ * Returns whether or not file compression is in use.
+ */
+- (BOOL)exportOutputCompressFile
+{
+ return exportOutputCompressFile;
+}
+
+/**
+ * Sets whether or not the resulting output of this exporter should be compressed.
+ */
+- (void)setExportOutputCompressFile:(BOOL)compress
+{
+ // If the export file handle is nil or a compression format has not yet been set don't proceed
+ if ((!exportOutputFileHandle) || ([self exportOutputCompressionFormat] == SPNoCompression)) return;
+
+ exportOutputCompressFile = compress;
+
+ [[self exportOutputFileHandle] setShouldWriteWithCompressionFormat:(compress) ? [self exportOutputCompressionFormat] : SPNoCompression];
+}
+
+/**
* Get rid of the export data.
*/
- (void)dealloc