diff options
author | rowanbeentje <rowan@beent.je> | 2012-06-10 21:11:12 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2012-06-10 21:11:12 +0000 |
commit | 2919f39e402aa7219958454ca0da452af3e163e9 (patch) | |
tree | a536d82495049f73e56af6324d2460ecac0b91ab /Source/SPExportInitializer.m | |
parent | e4afd6305a2e4a5f57987c4aa7938d2ba20f5676 (diff) | |
download | sequelpro-2919f39e402aa7219958454ca0da452af3e163e9.tar.gz sequelpro-2919f39e402aa7219958454ca0da452af3e163e9.tar.bz2 sequelpro-2919f39e402aa7219958454ca0da452af3e163e9.zip |
- Improve export encoding changes to occur after the export start, fixing errors when exports are interrupted, for example by file path errors, and then restarted. This addresses Issue #1364.
Diffstat (limited to 'Source/SPExportInitializer.m')
-rw-r--r-- | Source/SPExportInitializer.m | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/Source/SPExportInitializer.m b/Source/SPExportInitializer.m index d9ce4ecb..7ddf4aa8 100644 --- a/Source/SPExportInitializer.m +++ b/Source/SPExportInitializer.m @@ -68,6 +68,15 @@ didEndSelector:nil contextInfo:nil]; } + + // If using an export type that requires the connection to start in UTF8, cache the current connection + // encoding and then set it here. + if (exportType == SPSQLExport || exportType == SPDotExport) { + previousConnectionEncoding = [[NSString alloc] initWithString:[connection encoding]]; + previousConnectionEncodingViaLatin1 = [connection encodingUsesLatin1Transport]; + + [tableDocumentInstance setConnectionEncoding:@"utf8" reloadingViews:NO]; + } // Add the first exporter to the operation queue [operationQueue addOperation:[exporters objectAtIndex:0]]; @@ -281,12 +290,6 @@ [sqlExporter setSqlInsertAfterNValue:[exportSQLInsertNValueTextField integerValue]]; [sqlExporter setSqlInsertDivider:[exportSQLInsertDividerPopUpButton indexOfSelectedItem]]; - // Cache the current connection encoding then change it to UTF-8 to allow SQL dumps to work - previousConnectionEncoding = [[NSString alloc] initWithString:[connection encoding]]; - previousConnectionEncodingViaLatin1 = [connection encodingUsesLatin1Transport]; - - [tableDocumentInstance setConnectionEncoding:@"utf8" reloadingViews:NO]; - [sqlExporter setSqlExportTables:exportTables]; // Create custom filename if required @@ -380,13 +383,7 @@ [dotExporter setDotDatabaseHost:[tableDocumentInstance host]]; [dotExporter setDotDatabaseName:[tableDocumentInstance database]]; [dotExporter setDotDatabaseVersion:[tableDocumentInstance mySQLVersion]]; - - // Cache the current connection encoding then change it to UTF-8 to allow dumps to work - previousConnectionEncoding = [[NSString alloc] initWithString:[connection encoding]]; - previousConnectionEncodingViaLatin1 = [connection encodingUsesLatin1Transport]; - - [tableDocumentInstance setConnectionEncoding:@"utf8" reloadingViews:NO]; - + [dotExporter setDotExportTables:exportTables]; // Create custom filename if required |