aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPXMLExporter.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2010-06-06 15:04:31 +0000
committerstuconnolly <stuart02@gmail.com>2010-06-06 15:04:31 +0000
commit42781adb6cfa7f01f3763aade1b5043995930756 (patch)
treea1b38d9eab134fc59fe189f2e16cc823ef457361 /Source/SPXMLExporter.m
parent24c1421cd5ff96d567a64903f4134f3364a3dd9c (diff)
downloadsequelpro-42781adb6cfa7f01f3763aade1b5043995930756.tar.gz
sequelpro-42781adb6cfa7f01f3763aade1b5043995930756.tar.bz2
sequelpro-42781adb6cfa7f01f3763aade1b5043995930756.zip
On the XML export dialog add the option to specify the placeholder of exported NULL values. Fixes issue #718.
Diffstat (limited to 'Source/SPXMLExporter.m')
-rw-r--r--Source/SPXMLExporter.m19
1 files changed, 14 insertions, 5 deletions
diff --git a/Source/SPXMLExporter.m b/Source/SPXMLExporter.m
index 0c060a55..eddfabbf 100644
--- a/Source/SPXMLExporter.m
+++ b/Source/SPXMLExporter.m
@@ -37,6 +37,7 @@
@synthesize delegate;
@synthesize xmlDataArray;
@synthesize xmlTableName;
+@synthesize xmlNULLString;
/**
* Initialise an instance of SPXMLExporter using the supplied delegate.
@@ -73,7 +74,8 @@
// Check to see if we have at least a table name or data array
if ((![self xmlTableName]) && (![self xmlDataArray]) ||
- ([[self xmlTableName] isEqualToString:@""]) && ([[self xmlDataArray] count] == 0))
+ ([[self xmlTableName] length] == 0) && ([[self xmlDataArray] count] == 0) ||
+ (![self xmlNULLString]))
{
[pool release];
return;
@@ -170,19 +172,24 @@
return;
}
+ id data = NSArrayObjectAtIndex(xmlRow, i);
+
// Retrieve the contents of this tag
- if ([NSArrayObjectAtIndex(xmlRow, i) isKindOfClass:[NSData class]]) {
- dataConversionString = [[NSString alloc] initWithData:NSArrayObjectAtIndex(xmlRow, i) encoding:[self exportOutputEncoding]];
+ if ([data isKindOfClass:[NSData class]]) {
+ dataConversionString = [[NSString alloc] initWithData:data encoding:[self exportOutputEncoding]];
if (dataConversionString == nil) {
- dataConversionString = [[NSString alloc] initWithData:NSArrayObjectAtIndex(xmlRow, i) encoding:NSASCIIStringEncoding];
+ dataConversionString = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
}
[xmlItem setString:[NSString stringWithString:dataConversionString]];
[dataConversionString release];
}
+ else if ([data isKindOfClass:[NSNull class]]) {
+ [xmlItem setString:[self xmlNULLString]];
+ }
else {
- [xmlItem setString:[NSArrayObjectAtIndex(xmlRow, i) description]];
+ [xmlItem setString:[data description]];
}
// Add the opening and closing tag and the contents to the XML string
@@ -249,6 +256,8 @@
if (xmlDataArray) [xmlDataArray release], xmlDataArray = nil;
if (xmlTableName) [xmlTableName release], xmlTableName = nil;
+ [xmlNULLString release], xmlNULLString = nil;
+
[super dealloc];
}