aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPXMLExporterDelegate.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2010-11-05 21:15:18 +0000
committerstuconnolly <stuart02@gmail.com>2010-11-05 21:15:18 +0000
commita9be9780875d249019bd0cdf55eba960fb6f44be (patch)
treeaf7477b3e9c964dedf67ff40385f5724713ccc03 /Source/SPXMLExporterDelegate.m
parentf683094590e4a95eb047893584493ed7b32e2a02 (diff)
downloadsequelpro-a9be9780875d249019bd0cdf55eba960fb6f44be.tar.gz
sequelpro-a9be9780875d249019bd0cdf55eba960fb6f44be.tar.bz2
sequelpro-a9be9780875d249019bd0cdf55eba960fb6f44be.zip
Complete the implementation of supporting MySQL's XML schema format when exporting. Also, restore our old format and give the user the choice during export (defaults to MySQL schema). Completes the implementation of issue #840.
Diffstat (limited to 'Source/SPXMLExporterDelegate.m')
-rw-r--r--Source/SPXMLExporterDelegate.m21
1 files changed, 18 insertions, 3 deletions
diff --git a/Source/SPXMLExporterDelegate.m b/Source/SPXMLExporterDelegate.m
index cae852ac..9d8b97cf 100644
--- a/Source/SPXMLExporterDelegate.m
+++ b/Source/SPXMLExporterDelegate.m
@@ -69,8 +69,16 @@
// If we're exporting to multiple files then close the file handle of the exporter
// that just finished, ensuring its data is written to disk.
if (exportToMultipleFiles) {
- [[exporter exportOutputFile] writeData:[(exportSource == SPTableExport) ? @"</database>\n</mysqldump>\n" : @"</resultset>\n" dataUsingEncoding:[connection stringEncoding]]];
+ NSString *string = @"";
+ if ([exporter xmlFormat] == SPXMLExportMySQLFormat) {
+ string = (exportSource == SPTableExport) ? @"</database>\n</mysqldump>\n" : @"</resultset>\n";;
+ }
+ else if ([exporter xmlFormat] == SPXMLExportPlainFormat) {
+ string = [NSString stringWithFormat:@"</%@>\n", [[tableDocumentInstance database] HTMLEscapeString]];
+ }
+
+ [[exporter exportOutputFile] writeData:[string dataUsingEncoding:[connection stringEncoding]]];
[[exporter exportOutputFile] close];
}
@@ -82,9 +90,16 @@
}
// Otherwise if the exporter list is empty, close the progress sheet
else {
- [[exporter exportOutputFile] writeData:[(exportSource == SPTableExport) ? @"</database>\n</mysqldump>\n" : @"</resultset>\n" dataUsingEncoding:[connection stringEncoding]]];
+ NSString *string = @"";
+
+ if ([exporter xmlFormat] == SPXMLExportMySQLFormat) {
+ string = (exportSource == SPTableExport) ? @"</database>\n</mysqldump>\n" : @"</resultset>\n";;
+ }
+ else if ([exporter xmlFormat] == SPXMLExportPlainFormat) {
+ string = [NSString stringWithFormat:@"</%@>\n", [[tableDocumentInstance database] HTMLEscapeString]];
+ }
- // Close the last exporter's file handle
+ [[exporter exportOutputFile] writeData:[string dataUsingEncoding:[connection stringEncoding]]];
[[exporter exportOutputFile] close];
[NSApp endSheet:exportProgressWindow returnCode:0];