aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/SPCSVExporter.m2
-rw-r--r--Source/SPDotExporter.m10
-rw-r--r--Source/SPExporter.h17
-rw-r--r--Source/SPExporter.m10
-rw-r--r--Source/SPSQLExporter.m13
-rw-r--r--Source/SPXMLExporter.m10
6 files changed, 38 insertions, 24 deletions
diff --git a/Source/SPCSVExporter.m b/Source/SPCSVExporter.m
index 964f8f6f..6657aa8f 100644
--- a/Source/SPCSVExporter.m
+++ b/Source/SPCSVExporter.m
@@ -363,7 +363,7 @@
currentPoolDataLength += [csvString length];
// Write it to the fileHandle
- [[self exportOutputFile] writeData:[csvString dataUsingEncoding:[self exportOutputEncoding]]];
+ [self writeString:csvString];
currentRowIndex++;
diff --git a/Source/SPDotExporter.m b/Source/SPDotExporter.m
index 3e9213da..1353dbaf 100644
--- a/Source/SPDotExporter.m
+++ b/Source/SPDotExporter.m
@@ -103,7 +103,7 @@
[metaString appendString:@"\trankdir = LR;\n"];
// Write information to the file
- [[self exportOutputFile] writeData:[metaString dataUsingEncoding:NSUTF8StringEncoding]];
+ [self writeUTF8String:metaString];
NSMutableArray *fkInfo = [[NSMutableArray alloc] init];
@@ -150,9 +150,9 @@
[metaString appendString:@"\t\t\t</TABLE>>\n"];
[metaString appendString:@"\t\t];\n"];
[metaString appendString:@"\t}\n"];
-
- [[self exportOutputFile] writeData:[metaString dataUsingEncoding:NSUTF8StringEncoding]];
-
+
+ [self writeUTF8String:metaString];
+
// Check if any relations are available for the table
NSArray *tableConstraints = [tableInfo objectForKey:@"constraints"];
@@ -206,7 +206,7 @@
[metaString appendString:@"}\n"];
// Write information to the file
- [[self exportOutputFile] writeData:[metaString dataUsingEncoding:NSUTF8StringEncoding]];
+ [self writeUTF8String:metaString];
// Write data to disk
[[self exportOutputFile] close];
diff --git a/Source/SPExporter.h b/Source/SPExporter.h
index a2a19020..83a519c4 100644
--- a/Source/SPExporter.h
+++ b/Source/SPExporter.h
@@ -130,9 +130,26 @@
- (void)setExportOutputCompressFile:(BOOL)compress;
+#pragma mark Shared Private
+
/**
* This is the method you should override in every concrete exporter implementation.
*/
- (void)exportOperation;
+/**
+ * Write a string to the current output file using the current output encoding
+ * @param input The string to write
+ */
+- (void)writeString:(NSString *)input;
+
+/**
+ * Write a string to the current output file using UTF-8 encoding
+ * @param input The string to write
+ */
+#warning This method mainly exists to shorten some old code which sometimes uses [self exportOutputEncoding] and sometimes NSUTF8StringEncoding. \
+ In general there should be no need to have more than one encoding in a file. \
+ Someone needs to check if that was an oversight or intentional.
+- (void)writeUTF8String:(NSString *)input;
+
@end
diff --git a/Source/SPExporter.m b/Source/SPExporter.m
index adfe0545..ff90853c 100644
--- a/Source/SPExporter.m
+++ b/Source/SPExporter.m
@@ -119,6 +119,16 @@
[[[self exportOutputFile] exportFileHandle] setCompressionFormat:(compress) ? [self exportOutputCompressionFormat] : SPNoCompression];
}
+- (void)writeString:(NSString *)input
+{
+ [[self exportOutputFile] writeData:[input dataUsingEncoding:[self exportOutputEncoding]]];
+}
+
+- (void)writeUTF8String:(NSString *)input
+{
+ [[self exportOutputFile] writeData:[input dataUsingEncoding:NSUTF8StringEncoding]];
+}
+
/**
* Get rid of the export data.
*/
diff --git a/Source/SPSQLExporter.m b/Source/SPSQLExporter.m
index 1fde9ea0..8d53d0b3 100644
--- a/Source/SPSQLExporter.m
+++ b/Source/SPSQLExporter.m
@@ -901,19 +901,6 @@
return [placeholderSyntax autorelease];
}
-- (void)writeString:(NSString *)input
-{
- [[self exportOutputFile] writeData:[input dataUsingEncoding:[self exportOutputEncoding]]];
-}
-
-#warning This method mainly exists to shorten some old code which sometimes uses [self exportOutputEncoding] and sometimes NSUTF8StringEncoding. \
- In general there should be no need to have more than one encoding in a file (and we only really support utf-8 anyway). \
- Someone needs to check if that was an oversight or intentional.
-- (void)writeUTF8String:(NSString *)input
-{
- [[self exportOutputFile] writeData:[input dataUsingEncoding:NSUTF8StringEncoding]];
-}
-
#pragma mark -
- (void)dealloc
diff --git a/Source/SPXMLExporter.m b/Source/SPXMLExporter.m
index 39e89287..e1142d3a 100644
--- a/Source/SPXMLExporter.m
+++ b/Source/SPXMLExporter.m
@@ -157,7 +157,7 @@
[xmlString appendFormat:@"\t<table_data name=\"%@\">\n\n", [self xmlTableName]];
}
- [[self exportOutputFile] writeData:[xmlString dataUsingEncoding:[self exportOutputEncoding]]];
+ [self writeString:xmlString];
}
else {
totalRows = [[self xmlDataArray] count];
@@ -179,7 +179,7 @@
// If required, write an opening tag in the form of the table name
if ([self xmlFormat] == SPXMLExportPlainFormat) {
- [[self exportOutputFile] writeData:[[NSString stringWithFormat:@"\t<%@>\n", ([self xmlTableName]) ? [[self xmlTableName] HTMLEscapeString] : @"custom"] dataUsingEncoding:[self exportOutputEncoding]]];
+ [self writeString:[NSString stringWithFormat:@"\t<%@>\n", ([self xmlTableName]) ? [[self xmlTableName] HTMLEscapeString] : @"custom"]];
}
// Set up the starting row, which is 0 for streaming result sets and
@@ -295,7 +295,7 @@
currentPoolDataLength += [xmlString length];
// Write the row to the filehandle
- [[self exportOutputFile] writeData:[xmlString dataUsingEncoding:[self exportOutputEncoding]]];
+ [self writeString:xmlString];
// Update the progress counter and progress bar
currentRowIndex++;
@@ -324,10 +324,10 @@
}
if (([self xmlFormat] == SPXMLExportMySQLFormat) && isTableExport) {
- [[self exportOutputFile] writeData:[@"\t</table_data>\n\n" dataUsingEncoding:[self exportOutputEncoding]]];
+ [self writeString:@"\t</table_data>\n\n"];
}
else if ([self xmlFormat] == SPXMLExportPlainFormat) {
- [[self exportOutputFile] writeData:[[NSString stringWithFormat:@"\t</%@>\n\n", ([self xmlTableName]) ? [[self xmlTableName] HTMLEscapeString] : @"custom"] dataUsingEncoding:[self exportOutputEncoding]]];
+ [self writeString:[NSString stringWithFormat:@"\t</%@>\n\n", ([self xmlTableName]) ? [[self xmlTableName] HTMLEscapeString] : @"custom"]];
}
[xmlExportPool release];