aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-02-21 21:46:10 +0000
committerBibiko <bibiko@eva.mpg.de>2010-02-21 21:46:10 +0000
commit75c1cf6b0a918752c1a6a439e96e5cf8fba7e5ea (patch)
treec0a83cb8bf543b874b9cccd407554d42ad1f1b8b
parent829e22e75999e9390dd6f8c0310d5171829191f0 (diff)
downloadsequelpro-75c1cf6b0a918752c1a6a439e96e5cf8fba7e5ea.tar.gz
sequelpro-75c1cf6b0a918752c1a6a439e96e5cf8fba7e5ea.tar.bz2
sequelpro-75c1cf6b0a918752c1a6a439e96e5cf8fba7e5ea.zip
• CSV Import Field Mapper
- added Advanced sheet for setting IGNORE, DELAYED, ON DUPLICATE KEY UPDATE '<string>' for INSERT/REPLACE INTO • if during import CSV Import an error occurred show SP Console
-rw-r--r--Interfaces/English.lproj/DataMigrationDialog.xib647
-rw-r--r--Source/SPFieldMapperController.h15
-rw-r--r--Source/SPFieldMapperController.m102
-rw-r--r--Source/TableDocument.h2
-rw-r--r--Source/TableDump.h3
-rw-r--r--Source/TableDump.m26
6 files changed, 711 insertions, 84 deletions
diff --git a/Interfaces/English.lproj/DataMigrationDialog.xib b/Interfaces/English.lproj/DataMigrationDialog.xib
index 96e2d8da..6a8925cc 100644
--- a/Interfaces/English.lproj/DataMigrationDialog.xib
+++ b/Interfaces/English.lproj/DataMigrationDialog.xib
@@ -12,7 +12,8 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="162"/>
+ <integer value="225"/>
+ <integer value="161"/>
<integer value="12"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
@@ -407,6 +408,7 @@
<int key="NSTvFlags">1388347392</int>
<reference key="NSDelegate"/>
<reference key="NSDataSource"/>
+ <string key="NSAutosaveName">SPCSVFieldMappingTableView</string>
<int key="NSColumnAutoresizingStyle">1</int>
<int key="NSDraggingSourceMaskForLocal">15</int>
<int key="NSDraggingSourceMaskForNonLocal">0</int>
@@ -624,7 +626,7 @@
<object class="NSPopUpButton" id="599385609">
<reference key="NSNextResponder" ref="78582513"/>
<int key="NSvFlags">289</int>
- <string key="NSFrame">{{350, 130}, {98, 22}}</string>
+ <string key="NSFrame">{{338, 130}, {84, 22}}</string>
<reference key="NSSuperview" ref="78582513"/>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="1033308908">
@@ -689,7 +691,7 @@
<object class="NSTextField" id="228203205">
<reference key="NSNextResponder" ref="78582513"/>
<int key="NSvFlags">289</int>
- <string key="NSFrame">{{261, 135}, {94, 14}}</string>
+ <string key="NSFrame">{{253, 135}, {94, 14}}</string>
<reference key="NSSuperview" ref="78582513"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="869323357">
@@ -939,13 +941,13 @@ b3dzIFJFUExBQ0UgSU5UTyDigKY</bytes>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSColor">
+ <object class="NSColor" id="304176749">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">selectedTextBackgroundColor</string>
<reference key="NSColor" ref="240513327"/>
</object>
- <object class="NSColor">
+ <object class="NSColor" id="621386407">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">selectedTextColor</string>
@@ -964,11 +966,11 @@ b3dzIFJFUExBQ0UgSU5UTyDigKY</bytes>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSColor">
+ <object class="NSColor" id="1062455759">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MCAwIDEAA</bytes>
</object>
- <object class="NSCursor">
+ <object class="NSCursor" id="646479068">
<string key="NSHotSpot">{8, -8}</string>
<int key="NSCursorType">13</int>
</object>
@@ -1030,7 +1032,7 @@ b3dzIFJFUExBQ0UgSU5UTyDigKY</bytes>
<object class="NSPopUpButton" id="573115956">
<reference key="NSNextResponder" ref="78582513"/>
<int key="NSvFlags">292</int>
- <string key="NSFrame">{{17, 84}, {161, 22}}</string>
+ <string key="NSFrame">{{17, 85}, {161, 22}}</string>
<reference key="NSSuperview" ref="78582513"/>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="940205369">
@@ -1112,7 +1114,7 @@ b3dzIFJFUExBQ0UgSU5UTyDigKY</bytes>
<object class="NSTextField" id="155260473">
<reference key="NSNextResponder" ref="78582513"/>
<int key="NSvFlags">292</int>
- <string key="NSFrame">{{19, 107}, {117, 14}}</string>
+ <string key="NSFrame">{{19, 108}, {117, 14}}</string>
<reference key="NSSuperview" ref="78582513"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="498123343">
@@ -1125,26 +1127,6 @@ b3dzIFJFUExBQ0UgSU5UTyDigKY</bytes>
<reference key="NSTextColor" ref="263116164"/>
</object>
</object>
- <object class="NSButton" id="42651750">
- <reference key="NSNextResponder" ref="78582513"/>
- <int key="NSvFlags">-2147483356</int>
- <string key="NSFrame">{{20, 59}, {155, 17}}</string>
- <reference key="NSSuperview" ref="78582513"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="1001034034">
- <int key="NSCellFlags">-2080244224</int>
- <int key="NSCellFlags2">134348800</int>
- <string key="NSContents">Add global import value</string>
- <reference key="NSSupport" ref="26"/>
- <reference key="NSControlView" ref="42651750"/>
- <int key="NSButtonFlags">-2038152961</int>
- <int key="NSButtonFlags2">402653348</int>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent">a</string>
- <int key="NSPeriodicDelay">400</int>
- <int key="NSPeriodicInterval">75</int>
- </object>
- </object>
<object class="NSTextField" id="746818659">
<reference key="NSNextResponder" ref="78582513"/>
<int key="NSvFlags">269</int>
@@ -1185,6 +1167,30 @@ b3dzIFJFUExBQ0UgSU5UTyDigKY</bytes>
<int key="NSPeriodicInterval">25</int>
</object>
</object>
+ <object class="NSButton" id="42651750">
+ <reference key="NSNextResponder" ref="78582513"/>
+ <int key="NSvFlags">289</int>
+ <string key="NSFrame">{{423.5, 131}, {22, 22}}</string>
+ <reference key="NSSuperview" ref="78582513"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="1001034034">
+ <int key="NSCellFlags">-2080244224</int>
+ <int key="NSCellFlags2">134348800</int>
+ <string key="NSContents"/>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="42651750"/>
+ <int key="NSButtonFlags">-2033434369</int>
+ <int key="NSButtonFlags2">402653254</int>
+ <object class="NSCustomResource" key="NSNormalImage">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">NSAdvanced</string>
+ </object>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent">a</string>
+ <int key="NSPeriodicDelay">400</int>
+ <int key="NSPeriodicInterval">75</int>
+ </object>
+ </object>
</object>
<string key="NSFrameSize">{465, 405}</string>
<reference key="NSSuperview"/>
@@ -1195,18 +1201,18 @@ b3dzIFJFUExBQ0UgSU5UTyDigKY</bytes>
<string key="NSFrameAutosaveName">SPCSVFieldMappingSheet</string>
</object>
<object class="NSWindowTemplate" id="280523396">
- <int key="NSWindowStyleMask">9</int>
+ <int key="NSWindowStyleMask">15</int>
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{131, 316}, {311, 186}}</string>
- <int key="NSWTFlags">611845120</int>
+ <int key="NSWTFlags">1954021376</int>
<string key="NSWindowTitle">Window</string>
<string key="NSWindowClass">NSWindow</string>
<nil key="NSViewClass"/>
<string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
- <string key="NSWindowContentMinSize">{282, 186}</string>
+ <string key="NSWindowContentMinSize">{311, 186}</string>
<object class="NSView" key="NSWindowView" id="803374494">
<reference key="NSNextResponder"/>
- <int key="NSvFlags">289</int>
+ <int key="NSvFlags">274</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSScrollView" id="466562755">
@@ -1468,7 +1474,7 @@ b3dzIFJFUExBQ0UgSU5UTyDigKY</bytes>
</object>
<object class="NSButton" id="757708847">
<reference key="NSNextResponder" ref="803374494"/>
- <int key="NSvFlags">268</int>
+ <int key="NSvFlags">289</int>
<string key="NSFrame">{{102, 19}, {120, 18}}</string>
<reference key="NSSuperview" ref="803374494"/>
<bool key="NSEnabled">YES</bool>
@@ -1493,10 +1499,260 @@ b3dzIFJFUExBQ0UgSU5UTyDigKY</bytes>
<reference key="NSSuperview"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1280, 1002}}</string>
- <string key="NSMinSize">{282, 208}</string>
+ <string key="NSMinSize">{311, 208}</string>
<string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSFrameAutosaveName"/>
</object>
+ <object class="NSWindowTemplate" id="564599675">
+ <int key="NSWindowStyleMask">15</int>
+ <int key="NSWindowBacking">2</int>
+ <string key="NSWindowRect">{{131, 238}, {311, 190}}</string>
+ <int key="NSWTFlags">1954021376</int>
+ <string key="NSWindowTitle">Window</string>
+ <string key="NSWindowClass">NSWindow</string>
+ <nil key="NSViewClass"/>
+ <string key="NSWindowContentMinSize">{311, 190}</string>
+ <object class="NSView" key="NSWindowView" id="699476492">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">274</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSButton" id="356300263">
+ <reference key="NSNextResponder" ref="699476492"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{25, 154}, {70, 18}}</string>
+ <reference key="NSSuperview" ref="699476492"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="299767731">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">131072</int>
+ <string key="NSContents">IGNORE</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="356300263"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSNormalImage" ref="294469764"/>
+ <reference key="NSAlternateImage" ref="728464408"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSButton" id="310442563">
+ <reference key="NSNextResponder" ref="699476492"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{25, 134}, {80, 18}}</string>
+ <reference key="NSSuperview" ref="699476492"/>
+ <int key="NSTag">1</int>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="632579662">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">131072</int>
+ <string key="NSContents">DELAYED</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="310442563"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSNormalImage" ref="294469764"/>
+ <reference key="NSAlternateImage" ref="728464408"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSButton" id="728153759">
+ <reference key="NSNextResponder" ref="699476492"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{25, 114}, {202, 18}}</string>
+ <reference key="NSSuperview" ref="699476492"/>
+ <int key="NSTag">2</int>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="372006281">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">131072</int>
+ <string key="NSContents">ON DUPLICATE KEY UPDATE:</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="728153759"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSNormalImage" ref="294469764"/>
+ <reference key="NSAlternateImage" ref="728464408"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSScrollView" id="326072851">
+ <reference key="NSNextResponder" ref="699476492"/>
+ <int key="NSvFlags">274</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSClipView" id="904582017">
+ <reference key="NSNextResponder" ref="326072851"/>
+ <int key="NSvFlags">2304</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSTextView" id="155850591">
+ <reference key="NSNextResponder" ref="904582017"/>
+ <int key="NSvFlags">2330</int>
+ <object class="NSMutableSet" key="NSDragTypes">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="set.sortedObjects">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>Apple HTML pasteboard type</string>
+ <string>Apple PDF pasteboard type</string>
+ <string>Apple PICT pasteboard type</string>
+ <string>Apple PNG pasteboard type</string>
+ <string>Apple URL pasteboard type</string>
+ <string>CorePasteboardFlavorType 0x6D6F6F76</string>
+ <string>NSColor pasteboard type</string>
+ <string>NSFilenamesPboardType</string>
+ <string>NSStringPboardType</string>
+ <string>NeXT Encapsulated PostScript v1.2 pasteboard type</string>
+ <string>NeXT RTFD pasteboard type</string>
+ <string>NeXT Rich Text Format v1.0 pasteboard type</string>
+ <string>NeXT TIFF v4.0 pasteboard type</string>
+ <string>NeXT font pasteboard type</string>
+ <string>NeXT ruler pasteboard type</string>
+ <string>WebURLsWithTitlesPboardType</string>
+ <string>public.url</string>
+ </object>
+ </object>
+ <string key="NSFrameSize">{269, 36}</string>
+ <reference key="NSSuperview" ref="904582017"/>
+ <object class="NSTextContainer" key="NSTextContainer" id="903171248">
+ <object class="NSLayoutManager" key="NSLayoutManager">
+ <object class="NSTextStorage" key="NSTextStorage">
+ <object class="NSMutableString" key="NSString">
+ <characters key="NS.bytes"/>
+ </object>
+ <nil key="NSDelegate"/>
+ </object>
+ <object class="NSMutableArray" key="NSTextContainers">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="903171248"/>
+ </object>
+ <int key="NSLMFlags">134</int>
+ <nil key="NSDelegate"/>
+ </object>
+ <reference key="NSTextView" ref="155850591"/>
+ <double key="NSWidth">269</double>
+ <int key="NSTCFlags">1</int>
+ </object>
+ <object class="NSTextViewSharedData" key="NSSharedData">
+ <int key="NSFlags">11555</int>
+ <int key="NSTextCheckingTypes">0</int>
+ <nil key="NSMarkedAttributes"/>
+ <reference key="NSBackgroundColor" ref="746040121"/>
+ <object class="NSDictionary" key="NSSelectedAttributes">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>NSBackgroundColor</string>
+ <string>NSColor</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="304176749"/>
+ <reference ref="621386407"/>
+ </object>
+ </object>
+ <reference key="NSInsertionColor" ref="938074100"/>
+ <object class="NSDictionary" key="NSLinkAttributes">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>NSColor</string>
+ <string>NSCursor</string>
+ <string>NSUnderline</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="1062455759"/>
+ <reference ref="646479068"/>
+ <integer value="1"/>
+ </object>
+ </object>
+ <nil key="NSDefaultParagraphStyle"/>
+ </object>
+ <int key="NSTVFlags">6</int>
+ <string key="NSMaxSize">{463, 1e+07}</string>
+ <string key="NSMinize">{223, 36}</string>
+ <nil key="NSDelegate"/>
+ </object>
+ </object>
+ <string key="NSFrame">{{1, 1}, {269, 59}}</string>
+ <reference key="NSSuperview" ref="326072851"/>
+ <reference key="NSNextKeyView" ref="155850591"/>
+ <reference key="NSDocView" ref="155850591"/>
+ <reference key="NSBGColor" ref="746040121"/>
+ <object class="NSCursor" key="NSCursor">
+ <string key="NSHotSpot">{4, -5}</string>
+ <int key="NSCursorType">1</int>
+ </object>
+ <int key="NScvFlags">4</int>
+ </object>
+ <object class="NSScroller" id="109888708">
+ <reference key="NSNextResponder" ref="326072851"/>
+ <int key="NSvFlags">-2147483392</int>
+ <string key="NSFrame">{{255, 1}, {15, 44}}</string>
+ <reference key="NSSuperview" ref="326072851"/>
+ <reference key="NSTarget" ref="326072851"/>
+ <string key="NSAction">_doScroller:</string>
+ <double key="NSCurValue">1</double>
+ <double key="NSPercent">0.85256409645080566</double>
+ </object>
+ <object class="NSScroller" id="430947306">
+ <reference key="NSNextResponder" ref="326072851"/>
+ <int key="NSvFlags">-2147483392</int>
+ <string key="NSFrame">{{-100, -100}, {254, 15}}</string>
+ <reference key="NSSuperview" ref="326072851"/>
+ <int key="NSsFlags">1</int>
+ <reference key="NSTarget" ref="326072851"/>
+ <string key="NSAction">_doScroller:</string>
+ <double key="NSCurValue">1</double>
+ <double key="NSPercent">0.94565218687057495</double>
+ </object>
+ </object>
+ <string key="NSFrame">{{20, 45}, {271, 61}}</string>
+ <reference key="NSSuperview" ref="699476492"/>
+ <reference key="NSNextKeyView" ref="904582017"/>
+ <int key="NSsFlags">530</int>
+ <reference key="NSVScroller" ref="109888708"/>
+ <reference key="NSHScroller" ref="430947306"/>
+ <reference key="NSContentView" ref="904582017"/>
+ </object>
+ <object class="NSButton" id="961544149">
+ <reference key="NSNextResponder" ref="699476492"/>
+ <int key="NSvFlags">289</int>
+ <string key="NSFrame">{{226, 13}, {70, 28}}</string>
+ <reference key="NSSuperview" ref="699476492"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="920720182">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">134348800</int>
+ <string key="NSContents">OK</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="961544149"/>
+ <int key="NSButtonFlags">-2038284033</int>
+ <int key="NSButtonFlags2">129</int>
+ <string key="NSAlternateContents"/>
+ <string type="base64-UTF8" key="NSKeyEquivalent">DQ</string>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ </object>
+ <string key="NSFrameSize">{311, 190}</string>
+ <reference key="NSSuperview"/>
+ </object>
+ <string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
+ <string key="NSMinSize">{311, 212}</string>
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
+ </object>
<object class="NSUserDefaultsController" id="443551699">
<bool key="NSSharedInstance">YES</bool>
</object>
@@ -1682,14 +1938,6 @@ b3dzIFJFUExBQ0UgSU5UTyDigKY</bytes>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
- <string key="label">addGlobalSourceVariable:</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="42651750"/>
- </object>
- <int key="connectionID">156</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
<string key="label">goBackToFileChooser:</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="148795893"/>
@@ -1714,14 +1962,6 @@ b3dzIFJFUExBQ0UgSU5UTyDigKY</bytes>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
- <string key="label">globalValuesSheet</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="803374494"/>
- </object>
- <int key="connectionID">181</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
<string key="label">globalValuesTableView</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="666379639"/>
@@ -1824,6 +2064,102 @@ b3dzIFJFUExBQ0UgSU5UTyDigKY</bytes>
</object>
<int key="connectionID">223</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">ignoreCheckBox</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="356300263"/>
+ </object>
+ <int key="connectionID">242</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">delayedCheckBox</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="310442563"/>
+ </object>
+ <int key="connectionID">243</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">onupdateCheckBox</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="728153759"/>
+ </object>
+ <int key="connectionID">244</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">onupdateTextView</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="155850591"/>
+ </object>
+ <int key="connectionID">245</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">closeAdvancedSheet:</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="961544149"/>
+ </object>
+ <int key="connectionID">246</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">openAdvancedSheet:</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="42651750"/>
+ </object>
+ <int key="connectionID">248</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">globalValuesSheet</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="280523396"/>
+ </object>
+ <int key="connectionID">249</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">advancedSheet</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="564599675"/>
+ </object>
+ <int key="connectionID">250</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="564599675"/>
+ <reference key="destination" ref="1001"/>
+ </object>
+ <int key="connectionID">252</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">advancedCheckboxValidation:</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="310442563"/>
+ </object>
+ <int key="connectionID">253</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">advancedCheckboxValidation:</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="728153759"/>
+ </object>
+ <int key="connectionID">254</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">advancedButton</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="42651750"/>
+ </object>
+ <int key="connectionID">256</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -1882,9 +2218,9 @@ b3dzIFJFUExBQ0UgSU5UTyDigKY</bytes>
<reference ref="1053069492"/>
<reference ref="573115956"/>
<reference ref="155260473"/>
- <reference ref="42651750"/>
<reference ref="746818659"/>
<reference ref="148795893"/>
+ <reference ref="42651750"/>
</object>
<reference key="parent" ref="420604405"/>
</object>
@@ -2311,20 +2647,6 @@ b3dzIFJFUExBQ0UgSU5UTyDigKY</bytes>
<reference key="parent" ref="155260473"/>
</object>
<object class="IBObjectRecord">
- <int key="objectID">139</int>
- <reference key="object" ref="42651750"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="1001034034"/>
- </object>
- <reference key="parent" ref="78582513"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">140</int>
- <reference key="object" ref="1001034034"/>
- <reference key="parent" ref="42651750"/>
- </object>
- <object class="IBObjectRecord">
<int key="objectID">141</int>
<reference key="object" ref="771511410"/>
<reference key="parent" ref="877368345"/>
@@ -2535,6 +2857,125 @@ b3dzIFJFUExBQ0UgSU5UTyDigKY</bytes>
<reference key="object" ref="275652671"/>
<reference key="parent" ref="877368345"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">225</int>
+ <reference key="object" ref="564599675"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="699476492"/>
+ </object>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">Advanced Sheet</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">226</int>
+ <reference key="object" ref="699476492"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="356300263"/>
+ <reference ref="310442563"/>
+ <reference ref="728153759"/>
+ <reference ref="326072851"/>
+ <reference ref="961544149"/>
+ </object>
+ <reference key="parent" ref="564599675"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">227</int>
+ <reference key="object" ref="356300263"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="299767731"/>
+ </object>
+ <reference key="parent" ref="699476492"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">228</int>
+ <reference key="object" ref="299767731"/>
+ <reference key="parent" ref="356300263"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">231</int>
+ <reference key="object" ref="310442563"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="632579662"/>
+ </object>
+ <reference key="parent" ref="699476492"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">232</int>
+ <reference key="object" ref="632579662"/>
+ <reference key="parent" ref="310442563"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">233</int>
+ <reference key="object" ref="728153759"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="372006281"/>
+ </object>
+ <reference key="parent" ref="699476492"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">234</int>
+ <reference key="object" ref="372006281"/>
+ <reference key="parent" ref="728153759"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">235</int>
+ <reference key="object" ref="326072851"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="109888708"/>
+ <reference ref="430947306"/>
+ <reference ref="155850591"/>
+ </object>
+ <reference key="parent" ref="699476492"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">236</int>
+ <reference key="object" ref="109888708"/>
+ <reference key="parent" ref="326072851"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">237</int>
+ <reference key="object" ref="430947306"/>
+ <reference key="parent" ref="326072851"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">238</int>
+ <reference key="object" ref="155850591"/>
+ <reference key="parent" ref="326072851"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">239</int>
+ <reference key="object" ref="961544149"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="920720182"/>
+ </object>
+ <reference key="parent" ref="699476492"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">240</int>
+ <reference key="object" ref="920720182"/>
+ <reference key="parent" ref="961544149"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">139</int>
+ <reference key="object" ref="42651750"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="1001034034"/>
+ </object>
+ <reference key="parent" ref="78582513"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">140</int>
+ <reference key="object" ref="1001034034"/>
+ <reference key="parent" ref="42651750"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -2626,7 +3067,27 @@ b3dzIFJFUExBQ0UgSU5UTyDigKY</bytes>
<string>221.IBPluginDependency</string>
<string>222.IBPluginDependency</string>
<string>224.IBPluginDependency</string>
+ <string>225.IBEditorWindowLastContentRect</string>
+ <string>225.IBPluginDependency</string>
+ <string>225.IBWindowTemplateEditedContentRect</string>
+ <string>225.NSWindowTemplate.visibleAtLaunch</string>
+ <string>225.windowTemplate.hasMinSize</string>
+ <string>225.windowTemplate.minSize</string>
+ <string>226.IBPluginDependency</string>
+ <string>227.IBPluginDependency</string>
+ <string>228.IBPluginDependency</string>
+ <string>231.IBPluginDependency</string>
+ <string>232.IBPluginDependency</string>
+ <string>233.IBPluginDependency</string>
+ <string>234.IBPluginDependency</string>
+ <string>235.IBPluginDependency</string>
+ <string>236.IBPluginDependency</string>
+ <string>237.IBPluginDependency</string>
+ <string>238.CustomClassName</string>
+ <string>238.IBPluginDependency</string>
+ <string>239.IBPluginDependency</string>
<string>24.IBPluginDependency</string>
+ <string>240.IBPluginDependency</string>
<string>25.IBAttributePlaceholdersKey</string>
<string>25.IBPluginDependency</string>
<string>26.IBPluginDependency</string>
@@ -2675,9 +3136,9 @@ b3dzIFJFUExBQ0UgSU5UTyDigKY</bytes>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{231, 344}, {465, 405}}</string>
+ <string>{{266, 322}, {465, 405}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{231, 344}, {465, 405}}</string>
+ <string>{{266, 322}, {465, 405}}</string>
<integer value="1"/>
<string>{{387, 725}, {432, 282}}</string>
<integer value="0"/>
@@ -2707,7 +3168,7 @@ b3dzIFJFUExBQ0UgSU5UTyDigKY</bytes>
<object class="IBToolTipAttribute" key="NS.object.0">
<string key="name">ToolTip</string>
<reference key="object" ref="42651750"/>
- <string key="toolTip">(⌥⌘A)</string>
+ <string key="toolTip">Advanced settings for import methods INSERT and REPLACE (⌥⌘A)</string>
</object>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -2748,12 +3209,12 @@ b3dzIFJFUExBQ0UgSU5UTyDigKY</bytes>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
- <string>{{232, 570}, {311, 186}}</string>
+ <string>{{68, 380}, {311, 186}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{232, 570}, {311, 186}}</string>
+ <string>{{68, 380}, {311, 186}}</string>
<boolean value="NO"/>
<boolean value="YES"/>
- <string>{282, 186}</string>
+ <string>{311, 186}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -2822,6 +3283,26 @@ b3dzIFJFUExBQ0UgSU5UTyDigKY</bytes>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>{{154, 262}, {311, 190}}</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>{{154, 262}, {311, 190}}</string>
+ <boolean value="NO"/>
+ <boolean value="YES"/>
+ <string>{311, 190}</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>
+ <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>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>CMTextView</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>
<object class="NSMutableDictionary">
<string key="NS.key.0">ToolTip</string>
@@ -2834,7 +3315,7 @@ b3dzIFJFUExBQ0UgSU5UTyDigKY</bytes>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{467, 414}, {106, 54}}</string>
+ <string>{{567, 442}, {95, 54}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -2892,7 +3373,7 @@ b3dzIFJFUExBQ0UgSU5UTyDigKY</bytes>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">224</int>
+ <int key="maxID">256</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -2930,14 +3411,17 @@ b3dzIFJFUExBQ0UgSU5UTyDigKY</bytes>
<bool key="EncodedWithXMLCoder">YES</bool>
<string>addGlobalSourceVariable:</string>
<string>addGlobalValue:</string>
+ <string>advancedCheckboxValidation:</string>
<string>changeFieldAlignment:</string>
<string>changeHasHeaderCheckbox:</string>
<string>changeImportMethod:</string>
<string>changeTableTarget:</string>
+ <string>closeAdvancedSheet:</string>
<string>closeGlobalValuesSheet:</string>
<string>closeSheet:</string>
<string>goBackToFileChooser:</string>
<string>insertNULLValue:</string>
+ <string>openAdvancedSheet:</string>
<string>removeGlobalValue:</string>
<string>stepRow:</string>
</object>
@@ -2955,6 +3439,9 @@ b3dzIFJFUExBQ0UgSU5UTyDigKY</bytes>
<string>id</string>
<string>id</string>
<string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
@@ -2962,17 +3449,23 @@ b3dzIFJFUExBQ0UgSU5UTyDigKY</bytes>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>addGlobalValueButton</string>
+ <string>advancedButton</string>
+ <string>advancedSheet</string>
<string>alignByPopup</string>
+ <string>delayedCheckBox</string>
<string>fieldMapperTableView</string>
<string>fieldMappingImportArray</string>
<string>fileSourcePath</string>
<string>globalValuesSheet</string>
<string>globalValuesTableView</string>
+ <string>ignoreCheckBox</string>
<string>importButton</string>
<string>importFieldNamesHeaderSwitch</string>
<string>importMethodPopup</string>
<string>insertNULLValueButton</string>
<string>matchingNameMenuItem</string>
+ <string>onupdateCheckBox</string>
+ <string>onupdateTextView</string>
<string>recordCountLabel</string>
<string>removeGlobalValueButton</string>
<string>replaceAfterSavingCheckBox</string>
@@ -2984,7 +3477,10 @@ b3dzIFJFUExBQ0UgSU5UTyDigKY</bytes>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>NSButton</string>
+ <string>id</string>
+ <string>id</string>
<string>NSPopUpButton</string>
+ <string>id</string>
<string>NSTableView</string>
<string>id</string>
<string>NSPathControl</string>
@@ -2992,10 +3488,13 @@ b3dzIFJFUExBQ0UgSU5UTyDigKY</bytes>
<string>NSTableView</string>
<string>id</string>
<string>id</string>
+ <string>id</string>
<string>NSPopUpButton</string>
<string>NSButton</string>
<string>NSMenuItem</string>
<string>id</string>
+ <string>CMTextView</string>
+ <string>id</string>
<string>NSButton</string>
<string>id</string>
<string>id</string>
diff --git a/Source/SPFieldMapperController.h b/Source/SPFieldMapperController.h
index 4a6441ca..5bca61d0 100644
--- a/Source/SPFieldMapperController.h
+++ b/Source/SPFieldMapperController.h
@@ -24,6 +24,7 @@
#import <Cocoa/Cocoa.h>
#import <MCPKit/MCPKit.h>
+#import "CMTextView.h"
@interface SPFieldMapperController : NSWindowController {
@@ -46,6 +47,14 @@
IBOutlet NSButton *insertNULLValueButton;
IBOutlet id replaceAfterSavingCheckBox;
+ IBOutlet id advancedSheet;
+ IBOutlet id ignoreCheckBox;
+ IBOutlet id delayedCheckBox;
+ IBOutlet id onupdateCheckBox;
+ IBOutlet CMTextView *onupdateTextView;
+ IBOutlet id advancedButton;
+
+
id theDelegate;
id fieldMappingImportArray;
@@ -93,6 +102,8 @@
- (NSArray*)fieldMappingTableColumnNames;
- (NSArray*)fieldMappingGlobalValueArray;
- (BOOL)importFieldNamesHeader;
+- (NSString*)onupdateString;
+- (NSString*)importHeaderString;
// IBAction methods
- (IBAction)changeTableTarget:(id)sender;
@@ -101,6 +112,7 @@
- (IBAction)changeHasHeaderCheckbox:(id)sender;
- (IBAction)stepRow:(id)sender;
- (IBAction)addGlobalSourceVariable:(id)sender;
+- (IBAction)openAdvancedSheet:(id)sender;
- (IBAction)closeSheet:(id)sender;
- (IBAction)goBackToFileChooser:(id)sender;
@@ -108,6 +120,9 @@
- (IBAction)removeGlobalValue:(id)sender;
- (IBAction)insertNULLValue:(id)sender;
- (IBAction)closeGlobalValuesSheet:(id)sender;
+- (IBAction)closeAdvancedSheet:(id)sender;
+- (IBAction)advancedCheckboxValidation:(id)sender;
+
// Others
- (void)matchHeaderNames;
diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m
index 616497b4..ccf94f99 100644
--- a/Source/SPFieldMapperController.m
+++ b/Source/SPFieldMapperController.m
@@ -192,6 +192,30 @@
return ([importFieldNamesHeaderSwitch state] == NSOnState)?YES:NO;
}
+- (NSString*)importHeaderString
+{
+ if([[importMethodPopup titleOfSelectedItem] isEqualToString:@"INSERT"]) {
+ return [NSString stringWithFormat:@"INSERT %@%@INTO ",
+ ([delayedCheckBox state] == NSOnState) ? @"DELAYED " : @"",
+ ([ignoreCheckBox state] == NSOnState) ? @"IGNORE " : @""
+ ];
+ }
+ else if([[importMethodPopup titleOfSelectedItem] isEqualToString:@"REPLACE"]) {
+ return [NSString stringWithFormat:@"REPLACE %@INTO ",
+ ([delayedCheckBox state] == NSOnState) ? @"DELAYED " : @""
+ ];
+ }
+ return @"";
+}
+
+- (NSString*)onupdateString
+{
+ if([onupdateCheckBox state] == NSOnState && [[onupdateTextView string] length])
+ return [NSString stringWithFormat:@"ON DUPLICATE KEY UPDATE %@", [onupdateTextView string]];
+ else
+ return @"";
+}
+
#pragma mark -
#pragma mark IBAction methods
@@ -278,10 +302,13 @@
NSInteger i;
// If operator is set to = for UPDATE method replace it by doNotImport
if(![[importMethodPopup titleOfSelectedItem] isEqualToString:@"UPDATE"]) {
+ [advancedButton setEnabled:YES];
for(i=0; i<[fieldMappingTableColumnNames count]; i++) {
if([fieldMappingOperatorArray objectAtIndex:i] == isEqual)
[fieldMappingOperatorArray replaceObjectAtIndex:i withObject:doNotImport];
}
+ } else {
+ [advancedButton setEnabled:NO];
}
[self updateFieldMappingOperatorOptions];
@@ -351,9 +378,12 @@
[theDelegate importFile];
}
+#pragma mark -
+#pragma mark Global Value Sheet
+
- (IBAction)addGlobalSourceVariable:(id)sender
{
- [NSApp beginSheet:[globalValuesSheet window]
+ [NSApp beginSheet:globalValuesSheet
modalForWindow:[self window]
modalDelegate:self
didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:nil];
@@ -388,7 +418,7 @@
[globalValuesTableView reloadData];
// Set focus to favorite list to avoid an unstable state
- [[globalValuesSheet window] makeFirstResponder:globalValuesTableView];
+ [globalValuesSheet makeFirstResponder:globalValuesTableView];
[removeGlobalValueButton setEnabled:([globalValuesTableView numberOfSelectedRows] > 0)];
[insertNULLValueButton setEnabled:([globalValuesTableView numberOfSelectedRows] == 1)];
@@ -411,7 +441,7 @@
// Ensure all changes are stored before ordering out
[globalValuesTableView validateEditing];
if ([globalValuesTableView numberOfSelectedRows] == 1)
- [[globalValuesSheet window] makeFirstResponder:globalValuesTableView];
+ [globalValuesSheet makeFirstResponder:globalValuesTableView];
// Replace the current map pair with the last selected global value
if([replaceAfterSavingCheckBox state] == NSOnState && [globalValuesTableView numberOfSelectedRows] == 1) {
@@ -428,7 +458,66 @@
}
- [NSApp endSheet:[globalValuesSheet window] returnCode:[sender tag]];
+ [NSApp endSheet:globalValuesSheet returnCode:[sender tag]];
+}
+
+#pragma mark -
+#pragma mark Advanced Sheet
+
+- (IBAction)openAdvancedSheet:(id)sender
+{
+
+ if([[importMethodPopup titleOfSelectedItem] isEqualToString:@"REPLACE"]) {
+ [ignoreCheckBox setEnabled:NO];
+ [onupdateCheckBox setEnabled:NO];
+ [delayedCheckBox setEnabled:YES];
+ [onupdateTextView setBackgroundColor:[NSColor lightGrayColor]];
+ [onupdateTextView setEditable:NO];
+ }
+ else if([[importMethodPopup titleOfSelectedItem] isEqualToString:@"INSERT"]) {
+ [ignoreCheckBox setEnabled:YES];
+ [onupdateCheckBox setEnabled:([delayedCheckBox state] == NSOnState) ? NO : YES];
+ [delayedCheckBox setEnabled:([onupdateCheckBox state] == NSOnState) ? NO : YES];
+ if([onupdateCheckBox state] == NSOffState) {
+ [onupdateTextView setEditable:NO];
+ [onupdateTextView setBackgroundColor:[NSColor lightGrayColor]];
+ } else {
+ [onupdateTextView setEditable:YES];
+ [onupdateTextView setBackgroundColor:[NSColor whiteColor]];
+ }
+ }
+
+ [advancedSheet makeFirstResponder:ignoreCheckBox];
+
+ [NSApp beginSheet:advancedSheet
+ modalForWindow:[self window]
+ modalDelegate:self
+ didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:nil];
+}
+
+- (IBAction)closeAdvancedSheet:(id)sender
+{
+ [NSApp endSheet:advancedSheet returnCode:[sender tag]];
+}
+
+- (IBAction)advancedCheckboxValidation:(id)sender
+{
+
+ if([delayedCheckBox state] == NSOnState)
+ [onupdateCheckBox setState:NO];
+ if([onupdateCheckBox state] == NSOnState) {
+ [delayedCheckBox setState:NO];
+ [onupdateTextView setBackgroundColor:[NSColor whiteColor]];
+ [onupdateTextView setEditable:YES];
+ [advancedSheet makeFirstResponder:onupdateTextView];
+ } else {
+ [onupdateTextView setBackgroundColor:[NSColor lightGrayColor]];
+ [onupdateTextView setEditable:NO];
+ }
+
+ [onupdateCheckBox setEnabled:([delayedCheckBox state] == NSOnState) ? NO : YES];
+ [delayedCheckBox setEnabled:([onupdateCheckBox state] == NSOnState) ? NO : YES];
+
}
#pragma mark -
@@ -436,8 +525,9 @@
- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
{
- [[globalValuesSheet window] orderOut:self];
- [self updateFieldMappingButtonCell];
+ [sheet orderOut:self];
+ if (sheet == globalValuesSheet)
+ [self updateFieldMappingButtonCell];
}
- (void)matchHeaderNames
diff --git a/Source/TableDocument.h b/Source/TableDocument.h
index ca4bb812..6c03e01a 100644
--- a/Source/TableDocument.h
+++ b/Source/TableDocument.h
@@ -239,6 +239,8 @@
- (IBAction)backForwardInHistory:(id)sender;
- (IBAction)showUserManager:(id)sender;
+- (void)showConsole:(id)sender;
+
// Accessor methods
- (NSString *)host;
- (NSString *)name;
diff --git a/Source/TableDump.h b/Source/TableDump.h
index 9475649b..14149aa5 100644
--- a/Source/TableDump.h
+++ b/Source/TableDump.h
@@ -110,8 +110,11 @@ typedef enum _SPExportModes {
NSString *selectedTableTarget;
NSString *selectedImportMethod;
NSString *lastFilename;
+ NSString *csvImportHeaderString;
+ NSString *csvImportTailString;
NSInteger fieldMapperSheetStatus;
BOOL fieldMappingArrayHasGlobalVariables;
+ BOOL csvImportMethodHasTail;
NSUInteger exportMode;
NSUserDefaults *prefs;
diff --git a/Source/TableDump.m b/Source/TableDump.m
index 077b7f4f..46bb10d2 100644
--- a/Source/TableDump.m
+++ b/Source/TableDump.m
@@ -953,7 +953,7 @@
[singleProgressSheet makeKeyWindow];
// Set up the field names import string for INSERT or REPLACE INTO
- [insertBaseString appendFormat:@"%@ INTO ", selectedImportMethod];
+ [insertBaseString appendFormat:@"%@", csvImportHeaderString];
[insertBaseString appendString:[selectedTableTarget backtickQuotedString]];
[insertBaseString appendString:@" ("];
insertBaseStringHasEntries = NO;
@@ -993,16 +993,26 @@
}
// Perform the query
- [mySQLConnection queryString:query];
+ if(csvImportMethodHasTail)
+ [mySQLConnection queryString:[NSString stringWithFormat:@"%@ %@", query, csvImportTailString]];
+ else
+ [mySQLConnection queryString:query];
[query release];
// If an error occurred, run the queries individually to get exact line errors
if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
+ [tableDocumentInstance showConsole:nil];
for (i = 0; i < csvRowsThisQuery; i++) {
query = [[NSMutableString alloc] initWithString:insertBaseString];
[query appendString:[self mappedValueStringForRowArray:[parsedRows objectAtIndex:i]]];
- [mySQLConnection queryString:query];
+
+ // Perform the query
+ if(csvImportMethodHasTail)
+ [mySQLConnection queryString:[NSString stringWithFormat:@"%@ %@", query, csvImportTailString]];
+ else
+ [mySQLConnection queryString:query];
[query release];
+
if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
[errors appendString:[NSString stringWithFormat:
NSLocalizedString(@"[ERROR in row %ld] %@\n", @"error text when reading of csv file gave errors"),
@@ -1039,6 +1049,8 @@
[csvDataBuffer release];
[parsedRows release];
[parsePositions release];
+ if(csvImportTailString) [csvImportTailString release]; csvImportTailString = nil;
+ if(csvImportHeaderString) [csvImportHeaderString release]; csvImportHeaderString = nil;
if(fieldMappingArray) [fieldMappingArray release]; fieldMappingArray = nil;
if(fieldMappingGlobalValueArray) [fieldMappingGlobalValueArray release]; fieldMappingGlobalValueArray = nil;
if(fieldMapperOperator) [fieldMapperOperator release]; fieldMapperOperator = nil;
@@ -1184,6 +1196,9 @@
selectedImportMethod = [NSString stringWithString:[fieldMapperController selectedImportMethod]];
fieldMappingTableColumnNames = [NSArray arrayWithArray:[fieldMapperController fieldMappingTableColumnNames]];
fieldMappingGlobalValueArray = [[NSArray arrayWithArray:[fieldMapperController fieldMappingGlobalValueArray]] retain];
+ csvImportHeaderString = [[NSString stringWithString:[fieldMapperController importHeaderString]] retain];
+ csvImportTailString = [[NSString stringWithString:[fieldMapperController onupdateString]] retain];
+ csvImportMethodHasTail = ([csvImportTailString length] == 0) ? NO : YES;
if([fieldMappingImportArray count] && [fieldMappingGlobalValueArray count] > [NSArrayObjectAtIndex(fieldMappingImportArray,0) count])
fieldMappingArrayHasGlobalVariables = YES;
@@ -1433,7 +1448,7 @@
// Set up a result set in streaming mode
streamingResult = [mySQLConnection streamingQueryString:[NSString stringWithFormat:@"SELECT * FROM %@", [tableName backtickQuotedString]] useLowMemoryBlockingStreaming:([sqlFullStreamingSwitch state] == NSOnState)];
- fieldNames = [streamingResult fetchFieldNames];
+ fieldNames = [streamingResult fetchFieldNames];
// Update the progress text and set the progress bar back to determinate
[singleProgressText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Table %ld of %lu (%@): Dumping...", @"text showing that app is writing data for table dump"), (long)(i+1), (unsigned long)[selectedTables count], tableName]];
@@ -2797,6 +2812,9 @@
fieldMappingArray = nil;
fieldMappingGlobalValueArray = nil;
fieldMappingImportArray = nil;
+ csvImportTailString = nil;
+ csvImportHeaderString = nil;
+ csvImportMethodHasTail = NO;
fieldMappingImportArrayIsPreview = NO;
fieldMappingArrayHasGlobalVariables = NO;
prefs = nil;