diff options
author | stuconnolly <stuart02@gmail.com> | 2010-06-06 15:04:31 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2010-06-06 15:04:31 +0000 |
commit | 42781adb6cfa7f01f3763aade1b5043995930756 (patch) | |
tree | a1b38d9eab134fc59fe189f2e16cc823ef457361 | |
parent | 24c1421cd5ff96d567a64903f4134f3364a3dd9c (diff) | |
download | sequelpro-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.
-rw-r--r-- | Interfaces/English.lproj/ExportDialog.xib | 124 | ||||
-rw-r--r-- | Source/SPExportController.h | 5 | ||||
-rw-r--r-- | Source/SPExportController.m | 1 | ||||
-rw-r--r-- | Source/SPExportInitializer.m | 2 | ||||
-rw-r--r-- | Source/SPXMLExporter.h | 7 | ||||
-rw-r--r-- | Source/SPXMLExporter.m | 19 |
6 files changed, 132 insertions, 26 deletions
diff --git a/Interfaces/English.lproj/ExportDialog.xib b/Interfaces/English.lproj/ExportDialog.xib index 9dbedacf..82c6e212 100644 --- a/Interfaces/English.lproj/ExportDialog.xib +++ b/Interfaces/English.lproj/ExportDialog.xib @@ -2,7 +2,7 @@ <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10"> <data> <int key="IBDocument.SystemTarget">1050</int> - <string key="IBDocument.SystemVersion">10D2094</string> + <string key="IBDocument.SystemVersion">10D573</string> <string key="IBDocument.InterfaceBuilderVersion">762</string> <string key="IBDocument.AppKitVersion">1038.29</string> <string key="IBDocument.HIToolboxVersion">460.00</string> @@ -21,12 +21,12 @@ </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="1"/> + <integer value="34"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.brandonwalkin.BWToolkit</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> </object> <object class="NSMutableDictionary" key="IBDocument.Metadata"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -182,7 +182,7 @@ <bool key="EncodedWithXMLCoder">YES</bool> </object> </object> - <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{450, 462}</string> <object class="NSView" key="NSWindowView" id="13817034"> <reference key="NSNextResponder"/> @@ -267,7 +267,7 @@ <string key="NSColorName">controlBackgroundColor</string> <object class="NSColor" key="NSColor" id="1056664274"> <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes> + <bytes key="NSWhite">MC42NjY2NjY2ODY1AA</bytes> </object> </object> <object class="NSColor" key="NSTextColor" id="804867667"> @@ -703,7 +703,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> <object class="NSTabViewItem" id="838824691"> <string key="NSIdentifier">sql</string> <object class="NSView" key="NSView" id="382068224"> - <reference key="NSNextResponder" ref="281488100"/> + <nil key="NSNextResponder"/> <int key="NSvFlags">256</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -895,7 +895,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> </object> </object> <string key="NSFrame">{{10, 7}, {189, 239}}</string> - <reference key="NSSuperview" ref="281488100"/> </object> <string key="NSLabel">SQL</string> <reference key="NSColor" ref="683790803"/> @@ -1605,7 +1604,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> <object class="NSTextField" id="734041147"> <reference key="NSNextResponder" ref="1070450836"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{5, 39}, {88, 14}}</string> + <string key="NSFrame">{{5, 39}, {72, 14}}</string> <reference key="NSSuperview" ref="1070450836"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="893875441"> @@ -1702,9 +1701,46 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> <object class="NSTabViewItem" id="706447767"> <string key="NSIdentifier">xml</string> <object class="NSView" key="NSView" id="1008336044"> - <nil key="NSNextResponder"/> + <reference key="NSNextResponder" ref="281488100"/> <int key="NSvFlags">256</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSTextField" id="599286162"> + <reference key="NSNextResponder" ref="1008336044"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{11, 210}, {72, 14}}</string> + <reference key="NSSuperview" ref="1008336044"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="684609645"> + <int key="NSCellFlags">68288064</int> + <int key="NSCellFlags2">272761856</int> + <string key="NSContents">NULL values:</string> + <reference key="NSSupport" ref="26"/> + <reference key="NSControlView" ref="599286162"/> + <reference key="NSBackgroundColor" ref="683790803"/> + <reference key="NSTextColor" ref="804867667"/> + </object> + </object> + <object class="NSTextField" id="110569151"> + <reference key="NSNextResponder" ref="1008336044"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{14, 183}, {55, 19}}</string> + <reference key="NSSuperview" ref="1008336044"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="529644541"> + <int key="NSCellFlags">-1804468671</int> + <int key="NSCellFlags2">272761856</int> + <string key="NSContents"/> + <reference key="NSSupport" ref="26"/> + <reference key="NSControlView" ref="110569151"/> + <bool key="NSDrawsBackground">YES</bool> + <reference key="NSBackgroundColor" ref="895047516"/> + <reference key="NSTextColor" ref="876496808"/> + </object> + </object> + </object> <string key="NSFrame">{{10, 7}, {189, 239}}</string> + <reference key="NSSuperview" ref="281488100"/> </object> <string key="NSLabel">XML</string> <reference key="NSColor" ref="683790803"/> @@ -1774,14 +1810,14 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> <reference key="NSTabView" ref="281488100"/> </object> </object> - <reference key="NSSelectedTabViewItem" ref="838824691"/> + <reference key="NSSelectedTabViewItem" ref="706447767"/> <reference key="NSFont" ref="695505032"/> <int key="NSTvFlags">4</int> <bool key="NSAllowTruncatedLabels">YES</bool> <bool key="NSDrawsBackground">YES</bool> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="382068224"/> + <reference ref="1008336044"/> </object> </object> <object class="NSButton" id="413491970"> @@ -2165,7 +2201,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> </object> <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string> <string key="NSMinSize">{450, 539}</string> - <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSFrameAutosaveName">SPExportWindow</string> </object> <object class="NSCustomView" id="673454061"> @@ -2310,7 +2346,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> <object class="NSMutableString" key="NSViewClass"> <characters key="NS.bytes">View</characters> </object> - <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{213, 50}</string> <object class="NSView" key="NSWindowView" id="217849587"> <nil key="NSNextResponder"/> @@ -2434,7 +2470,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> </object> <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string> <string key="NSMinSize">{213, 72}</string> - <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> </object> <object class="NSWindowTemplate" id="172544148"> <int key="NSWindowStyleMask">9</int> @@ -2446,7 +2482,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> <object class="NSMutableString" key="NSViewClass"> <characters key="NS.bytes">View</characters> </object> - <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{213, 107}</string> <object class="NSView" key="NSWindowView" id="487307915"> <nil key="NSNextResponder"/> @@ -2633,7 +2669,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> </object> <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string> <string key="NSMinSize">{213, 129}</string> - <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> </object> </object> <object class="IBObjectContainer" key="IBDocument.Objects"> @@ -3207,6 +3243,14 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> </object> <int key="connectionID">487</int> </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">exportXMLNULLValuesAsTextField</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="110569151"/> + </object> + <int key="connectionID">496</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -3493,6 +3537,8 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> <reference key="object" ref="1008336044"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="599286162"/> + <reference ref="110569151"/> </object> <reference key="parent" ref="706447767"/> </object> @@ -4506,6 +4552,34 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> <reference key="object" ref="240212124"/> <reference key="parent" ref="676012428"/> </object> + <object class="IBObjectRecord"> + <int key="objectID">492</int> + <reference key="object" ref="599286162"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="684609645"/> + </object> + <reference key="parent" ref="1008336044"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">493</int> + <reference key="object" ref="110569151"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="529644541"/> + </object> + <reference key="parent" ref="1008336044"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">494</int> + <reference key="object" ref="529644541"/> + <reference key="parent" ref="110569151"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">495</int> + <reference key="object" ref="684609645"/> + <reference key="parent" ref="599286162"/> + </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> @@ -4681,6 +4755,10 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> <string>49.IBAttributePlaceholdersKey</string> <string>49.IBPluginDependency</string> <string>49.ImportedFromIB2</string> + <string>492.IBPluginDependency</string> + <string>493.IBPluginDependency</string> + <string>494.IBPluginDependency</string> + <string>495.IBPluginDependency</string> <string>50.IBPluginDependency</string> <string>50.ImportedFromIB2</string> <string>51.IBPluginDependency</string> @@ -4744,11 +4822,11 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{360, 183}, {450, 462}}</string> + <string>{{507, 135}, {450, 462}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <boolean value="NO"/> <boolean value="NO"/> - <string>{{360, 183}, {450, 462}}</string> + <string>{{507, 135}, {450, 462}}</string> <boolean value="NO"/> <boolean value="YES"/> <string>{450, 462}</string> @@ -4824,7 +4902,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> <boolean value="YES"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <boolean value="YES"/> - <string>{{277, 645}, {616, 0}}</string> + <string>{{424, 597}, {616, 0}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -4963,6 +5041,10 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -5060,7 +5142,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> </object> </object> <nil key="sourceID"/> - <int key="maxID">491</int> + <int key="maxID">496</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -5280,6 +5362,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> <string>exportTablelistScrollView</string> <string>exportToolbar</string> <string>exportUseUTF8BOMButton</string> + <string>exportXMLNULLValuesAsTextField</string> <string>tableContentInstance</string> <string>tableDataInstance</string> <string>tableDocumentInstance</string> @@ -5332,6 +5415,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> <string>NSScrollView</string> <string>NSToolbar</string> <string>NSButton</string> + <string>NSTextField</string> <string>id</string> <string>id</string> <string>id</string> diff --git a/Source/SPExportController.h b/Source/SPExportController.h index 0865fef3..32541d19 100644 --- a/Source/SPExportController.h +++ b/Source/SPExportController.h @@ -70,7 +70,6 @@ IBOutlet NSButton *exportUseUTF8BOMButton; IBOutlet NSButton *exportCompressOutputFile; IBOutlet NSButton *exportProcessLowMemoryButton; - IBOutlet NSTextField *exportCSVNULLValuesAsTextField; IBOutlet BWAnchoredButtonBar *exportTableListButtonBar; @@ -103,6 +102,10 @@ IBOutlet NSComboBox *exportCSVFieldsWrappedField; IBOutlet NSComboBox *exportCSVFieldsEscapedField; IBOutlet NSComboBox *exportCSVLinesTerminatedField; + IBOutlet NSTextField *exportCSVNULLValuesAsTextField; + + // XML + IBOutlet NSTextField *exportXMLNULLValuesAsTextField; // HTML IBOutlet NSButton *exportHTMLIncludeStructureCheck; diff --git a/Source/SPExportController.m b/Source/SPExportController.m index cb972551..6da5b544 100644 --- a/Source/SPExportController.m +++ b/Source/SPExportController.m @@ -325,6 +325,7 @@ [[[exportTableList tableColumnWithIdentifier:@"content"] headerCell] setStringValue:(disable) ? @"" : @"C"]; [exportCSVNULLValuesAsTextField setStringValue:[prefs stringForKey:SPNullValue]]; + [exportXMLNULLValuesAsTextField setStringValue:[prefs stringForKey:SPNullValue]]; } } diff --git a/Source/SPExportInitializer.m b/Source/SPExportInitializer.m index ce894628..0cfa88b1 100644 --- a/Source/SPExportInitializer.m +++ b/Source/SPExportInitializer.m @@ -540,6 +540,8 @@ // of table and table content exports. [xmlExporter setXmlTableName:[tablesListInstance tableName]]; + [xmlExporter setXmlNULLString:[exportXMLNULLValuesAsTextField stringValue]]; + // If required create separate files if ((exportSource == SPTableExport) && exportToMultipleFiles && (exportTableCount > 0)) { filename = [[exportPathField stringValue] stringByAppendingPathComponent:table]; diff --git a/Source/SPXMLExporter.h b/Source/SPXMLExporter.h index a9e6c2dd..f80aacc6 100644 --- a/Source/SPXMLExporter.h +++ b/Source/SPXMLExporter.h @@ -51,6 +51,11 @@ * Table name */ NSString *xmlTableName; + + /** + * XML NULL string + */ + NSString *xmlNULLString; } @property(readwrite, assign) NSObject *delegate; @@ -58,6 +63,8 @@ @property(readwrite, retain) NSArray *xmlDataArray; @property(readwrite, retain) NSString *xmlTableName; +@property(readwrite, retain) NSString *xmlNULLString; + /** * Initialise an instance of SPXMLExporter using the supplied delegate. * 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]; } |