aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2010-05-01 01:36:52 +0000
committerrowanbeentje <rowan@beent.je>2010-05-01 01:36:52 +0000
commit8acde6bf2580ce1e2feac2b9ac74dfa34b1ddf7e (patch)
tree4c2411b8f04d038d03013cae244d54566761ec96
parent9175848b8bbe6e4b9145a492d9b4da86adb8760d (diff)
downloadsequelpro-8acde6bf2580ce1e2feac2b9ac74dfa34b1ddf7e.tar.gz
sequelpro-8acde6bf2580ce1e2feac2b9ac74dfa34b1ddf7e.tar.bz2
sequelpro-8acde6bf2580ce1e2feac2b9ac74dfa34b1ddf7e.zip
Review trigger fetching and storage:
- Trigger queries are no longer made for MySQL < 5.0.2 - Trigger loading has been deferred until the trigger tab is active, reducing queries when switching tables and thus increasing overall responsiveness - Export triggers in MySQL dumps even if the Table Content switch is unchecked
-rw-r--r--Interfaces/English.lproj/DBView.xib175
-rw-r--r--Source/SPAppController.m1
-rw-r--r--Source/SPTableData.h1
-rw-r--r--Source/SPTableData.m81
-rw-r--r--Source/SPTableTriggers.h2
-rw-r--r--Source/SPTableTriggers.m95
-rw-r--r--Source/TableDump.m80
-rw-r--r--Source/TablesList.h3
-rw-r--r--Source/TablesList.m53
9 files changed, 289 insertions, 202 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib
index 0f676d67..c9944020 100644
--- a/Interfaces/English.lproj/DBView.xib
+++ b/Interfaces/English.lproj/DBView.xib
@@ -2,8 +2,8 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1050</int>
- <string key="IBDocument.SystemVersion">10D573</string>
- <string key="IBDocument.InterfaceBuilderVersion">740</string>
+ <string key="IBDocument.SystemVersion">10D2094</string>
+ <string key="IBDocument.InterfaceBuilderVersion">762</string>
<string key="IBDocument.AppKitVersion">1038.29</string>
<string key="IBDocument.HIToolboxVersion">460.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
@@ -16,8 +16,8 @@
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
- <string>740</string>
- <string>740</string>
+ <string>762</string>
+ <string>762</string>
<string>1.2.5</string>
</object>
</object>
@@ -281,6 +281,7 @@
</object>
<string key="NSFrame">{{1, 1}, {218, 38}}</string>
<reference key="NSSuperview" ref="607475905"/>
+ <reference key="NSNextKeyView" ref="970881282"/>
<reference key="NSDocView" ref="970881282"/>
<object class="NSColor" key="NSBGColor" id="1024678221">
<int key="NSColorSpace">6</int>
@@ -312,6 +313,7 @@
</object>
<string key="NSFrame">{{-1, -13}, {220.212, 40}}</string>
<reference key="NSSuperview" ref="801427893"/>
+ <reference key="NSNextKeyView" ref="494991824"/>
<int key="NSsFlags">2</int>
<reference key="NSVScroller" ref="196112633"/>
<reference key="NSHScroller" ref="142487484"/>
@@ -409,6 +411,7 @@
</object>
<string key="NSFrameSize">{214, 354}</string>
<reference key="NSSuperview" ref="233472824"/>
+ <reference key="NSNextKeyView" ref="251040077"/>
<reference key="NSDocView" ref="251040077"/>
<reference key="NSBGColor" ref="1024678221"/>
<int key="NScvFlags">4</int>
@@ -436,6 +439,7 @@
</object>
<string key="NSFrameSize">{214, 354}</string>
<reference key="NSSuperview" ref="1017775084"/>
+ <reference key="NSNextKeyView" ref="73685676"/>
<int key="NSsFlags">528</int>
<reference key="NSVScroller" ref="693168867"/>
<reference key="NSHScroller" ref="656188692"/>
@@ -571,6 +575,7 @@
</object>
<string key="NSFrameSize">{214, 145}</string>
<reference key="NSSuperview" ref="298226231"/>
+ <reference key="NSNextKeyView" ref="347093764"/>
<reference key="NSDocView" ref="347093764"/>
<reference key="NSBGColor" ref="1024678221"/>
<int key="NScvFlags">6</int>
@@ -598,6 +603,7 @@
</object>
<string key="NSFrameSize">{214, 145}</string>
<reference key="NSSuperview" ref="192579410"/>
+ <reference key="NSNextKeyView" ref="685057119"/>
<int key="NSsFlags">512</int>
<reference key="NSVScroller" ref="245346414"/>
<reference key="NSHScroller" ref="353686052"/>
@@ -802,7 +808,6 @@
</object>
</object>
</object>
- <int key="NSSelectedIndex">1</int>
<bool key="NSPullDown">YES</bool>
<int key="NSPreferredEdge">1</int>
<bool key="NSUsesItemFromMenu">YES</bool>
@@ -3976,6 +3981,7 @@
</object>
<string key="NSFrame">{{1, 1}, {542, 69}}</string>
<reference key="NSSuperview" ref="709531668"/>
+ <reference key="NSNextKeyView" ref="69074373"/>
<reference key="NSDocView" ref="69074373"/>
<reference key="NSBGColor" ref="449903125"/>
<reference key="NSCursor" ref="32917531"/>
@@ -4005,6 +4011,7 @@
</object>
<string key="NSFrame">{{96, 0}, {555, 71}}</string>
<reference key="NSSuperview" ref="259390764"/>
+ <reference key="NSNextKeyView" ref="78677381"/>
<int key="NSsFlags">18</int>
<reference key="NSVScroller" ref="892376800"/>
<reference key="NSHScroller" ref="490174802"/>
@@ -4112,6 +4119,7 @@
</object>
<string key="NSFrame">{{1, 1}, {542, 196}}</string>
<reference key="NSSuperview" ref="449863508"/>
+ <reference key="NSNextKeyView" ref="421486962"/>
<reference key="NSDocView" ref="421486962"/>
<reference key="NSBGColor" ref="449903125"/>
<reference key="NSCursor" ref="32917531"/>
@@ -4141,6 +4149,7 @@
</object>
<string key="NSFrame">{{96, 0}, {555, 198}}</string>
<reference key="NSSuperview" ref="983998494"/>
+ <reference key="NSNextKeyView" ref="637054939"/>
<int key="NSsFlags">18</int>
<reference key="NSVScroller" ref="633929130"/>
<reference key="NSHScroller" ref="883667132"/>
@@ -5560,7 +5569,7 @@
<string key="NSWindowContentMaxSize">{292, 112}</string>
<string key="NSWindowContentMinSize">{292, 112}</string>
<object class="NSView" key="NSWindowView" id="70075497">
- <reference key="NSNextResponder"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -5569,7 +5578,6 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{36, 75}, {91, 14}}</string>
<reference key="NSSuperview" ref="70075497"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="45988560">
<int key="NSCellFlags">68288064</int>
@@ -5586,7 +5594,6 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{17, 50}, {110, 14}}</string>
<reference key="NSSuperview" ref="70075497"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="410467805">
<int key="NSCellFlags">68288064</int>
@@ -5603,7 +5610,6 @@
<int key="NSvFlags">258</int>
<string key="NSFrame">{{135, 74}, {137, 18}}</string>
<reference key="NSSuperview" ref="70075497"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="212969926">
<int key="NSCellFlags">-1804468671</int>
@@ -5626,7 +5632,6 @@
<int key="NSvFlags">259</int>
<string key="NSFrame">{{207, 13}, {70, 28}}</string>
<reference key="NSSuperview" ref="70075497"/>
- <reference key="NSWindow"/>
<int key="NSTag">1</int>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="169260261">
@@ -5654,7 +5659,6 @@
<int key="NSvFlags">259</int>
<string key="NSFrame">{{139, 13}, {70, 28}}</string>
<reference key="NSSuperview" ref="70075497"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="994559297">
<int key="NSCellFlags">67239424</int>
@@ -5676,7 +5680,6 @@
<int key="NSvFlags">258</int>
<string key="NSFrame">{{132, 45}, {143, 22}}</string>
<reference key="NSSuperview" ref="70075497"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="1000126742">
<int key="NSCellFlags">-2076049856</int>
@@ -5997,8 +6000,6 @@
</object>
</object>
<string key="NSFrameSize">{292, 112}</string>
- <reference key="NSSuperview"/>
- <reference key="NSWindow"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
<string key="NSMinSize">{292, 134}</string>
@@ -6014,10 +6015,10 @@
<object class="NSMutableString" key="NSViewClass">
<characters key="NS.bytes">View</characters>
</object>
- <string key="NSWindowContentMaxSize">{292, 112}</string>
- <string key="NSWindowContentMinSize">{292, 112}</string>
+ <string key="NSWindowContentMaxSize">{292, 132}</string>
+ <string key="NSWindowContentMinSize">{292, 132}</string>
<object class="NSView" key="NSWindowView" id="351046403">
- <nil key="NSNextResponder"/>
+ <reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -6026,6 +6027,7 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{17, 98}, {258, 14}}</string>
<reference key="NSSuperview" ref="351046403"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="292220806">
<int key="NSCellFlags">68288064</int>
@@ -6042,6 +6044,7 @@
<int key="NSvFlags">258</int>
<string key="NSFrame">{{20, 72}, {252, 18}}</string>
<reference key="NSSuperview" ref="351046403"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="322980098">
<int key="NSCellFlags">-1804468671</int>
@@ -6059,6 +6062,7 @@
<int key="NSvFlags">259</int>
<string key="NSFrame">{{204, 13}, {77, 28}}</string>
<reference key="NSSuperview" ref="351046403"/>
+ <reference key="NSWindow"/>
<int key="NSTag">1</int>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="261586860">
@@ -6082,6 +6086,7 @@
<int key="NSvFlags">259</int>
<string key="NSFrame">{{136, 13}, {70, 28}}</string>
<reference key="NSSuperview" ref="351046403"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="1011860722">
<int key="NSCellFlags">67239424</int>
@@ -6103,6 +6108,7 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{18, 48}, {256, 18}}</string>
<reference key="NSSuperview" ref="351046403"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="852298622">
<int key="NSCellFlags">67239424</int>
@@ -6122,10 +6128,12 @@
</object>
</object>
<string key="NSFrameSize">{292, 132}</string>
+ <reference key="NSSuperview"/>
+ <reference key="NSWindow"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
- <string key="NSMinSize">{292, 134}</string>
- <string key="NSMaxSize">{292, 134}</string>
+ <string key="NSMinSize">{292, 154}</string>
+ <string key="NSMaxSize">{292, 154}</string>
</object>
<object class="NSWindowTemplate" id="223499819">
<int key="NSWindowStyleMask">1</int>
@@ -6241,7 +6249,7 @@
<string key="NSWindowContentMaxSize">{600, 142}</string>
<string key="NSWindowContentMinSize">{269, 142}</string>
<object class="NSView" key="NSWindowView" id="846512394">
- <reference key="NSNextResponder"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -6250,7 +6258,6 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{36, 105}, {71, 14}}</string>
<reference key="NSSuperview" ref="846512394"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="967312779">
<int key="NSCellFlags">68288064</int>
@@ -6267,7 +6274,6 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{17, 80}, {90, 14}}</string>
<reference key="NSSuperview" ref="846512394"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="308586219">
<int key="NSCellFlags">68288064</int>
@@ -6284,7 +6290,6 @@
<int key="NSvFlags">258</int>
<string key="NSFrame">{{112, 104}, {137, 18}}</string>
<reference key="NSSuperview" ref="846512394"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="39963071">
<int key="NSCellFlags">-1804468671</int>
@@ -6302,7 +6307,6 @@
<int key="NSvFlags">257</int>
<string key="NSFrame">{{184, 13}, {70, 28}}</string>
<reference key="NSSuperview" ref="846512394"/>
- <reference key="NSWindow"/>
<int key="NSTag">1</int>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="805893132">
@@ -6326,7 +6330,6 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{109, 75}, {143, 22}}</string>
<reference key="NSSuperview" ref="846512394"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="285868883">
<int key="NSCellFlags">-2076049856</int>
@@ -6650,7 +6653,6 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{41, 54}, {66, 14}}</string>
<reference key="NSSuperview" ref="846512394"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="193977111">
<int key="NSCellFlags">68288064</int>
@@ -6667,7 +6669,6 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{109, 50}, {143, 22}}</string>
<reference key="NSSuperview" ref="846512394"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="285541065">
<int key="NSCellFlags">-2076049856</int>
@@ -6703,7 +6704,6 @@
<int key="NSvFlags">257</int>
<string key="NSFrame">{{116, 13}, {70, 28}}</string>
<reference key="NSSuperview" ref="846512394"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="783843620">
<int key="NSCellFlags">67239424</int>
@@ -6722,8 +6722,6 @@
</object>
</object>
<string key="NSFrameSize">{269, 142}</string>
- <reference key="NSSuperview"/>
- <reference key="NSWindow"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
<string key="NSMinSize">{269, 164}</string>
@@ -6742,7 +6740,7 @@
<string key="NSWindowContentMaxSize">{600, 127}</string>
<string key="NSWindowContentMinSize">{260, 127}</string>
<object class="NSView" key="NSWindowView" id="653204527">
- <reference key="NSNextResponder"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -6751,7 +6749,6 @@
<int key="NSvFlags">266</int>
<string key="NSFrame">{{17, 93}, {226, 14}}</string>
<reference key="NSSuperview" ref="653204527"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="604072019">
<int key="NSCellFlags">67239488</int>
@@ -6768,7 +6765,6 @@
<int key="NSvFlags">258</int>
<string key="NSFrame">{{20, 67}, {220, 18}}</string>
<reference key="NSSuperview" ref="653204527"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="870160310">
<int key="NSCellFlags">-1804468671</int>
@@ -6786,7 +6782,6 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{19, 43}, {189, 18}}</string>
<reference key="NSSuperview" ref="653204527"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="575635343">
<int key="NSCellFlags">67239424</int>
@@ -6808,7 +6803,6 @@
<int key="NSvFlags">289</int>
<string key="NSFrame">{{158, 13}, {87, 28}}</string>
<reference key="NSSuperview" ref="653204527"/>
- <reference key="NSWindow"/>
<int key="NSTag">1</int>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="834960254">
@@ -6832,7 +6826,6 @@
<int key="NSvFlags">289</int>
<string key="NSFrame">{{80, 13}, {80, 28}}</string>
<reference key="NSSuperview" ref="653204527"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="1048025876">
<int key="NSCellFlags">67239424</int>
@@ -6851,8 +6844,6 @@
</object>
</object>
<string key="NSFrameSize">{260, 127}</string>
- <reference key="NSSuperview"/>
- <reference key="NSWindow"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
<string key="NSMinSize">{260, 149}</string>
@@ -7450,8 +7441,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<bool key="NS.raise.underflow">YES</bool>
<bool key="NS.raise.dividebyzero">YES</bool>
</object>
- <string key="NS.decimal">,</string>
- <string key="NS.thousand">.</string>
+ <string key="NS.decimal">.</string>
+ <string key="NS.thousand">,</string>
<bool key="NS.hasthousands">NO</bool>
<bool key="NS.localized">YES</bool>
<bool key="NS.allowsfloats">NO</bool>
@@ -8811,7 +8802,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
<string key="NSWindowContentMinSize">{350, 200}</string>
<object class="NSView" key="NSWindowView" id="749598685">
- <reference key="NSNextResponder"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -8820,7 +8811,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<int key="NSvFlags">257</int>
<string key="NSFrame">{{320, 5}, {76, 28}}</string>
<reference key="NSSuperview" ref="749598685"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="849738207">
<int key="NSCellFlags">67239424</int>
@@ -8842,7 +8832,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<int key="NSvFlags">257</int>
<string key="NSFrame">{{246, -215.5}, {76, 28}}</string>
<reference key="NSSuperview" ref="749598685"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="323973752">
<int key="NSCellFlags">67239424</int>
@@ -8864,7 +8853,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<int key="NSvFlags">260</int>
<string key="NSFrame">{{15, 5}, {111, 28}}</string>
<reference key="NSSuperview" ref="749598685"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="116117289">
<int key="NSCellFlags">-2080244224</int>
@@ -8885,7 +8873,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<int key="NSvFlags">266</int>
<string key="NSFrame">{{9, 316}, {385, 14}}</string>
<reference key="NSSuperview" ref="749598685"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="187876153">
<int key="NSCellFlags">68288064</int>
@@ -8912,7 +8899,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<int key="NSvFlags">2322</int>
<string key="NSFrameSize">{411, 14}</string>
<reference key="NSSuperview" ref="789153540"/>
- <reference key="NSWindow"/>
<object class="NSTextContainer" key="NSTextContainer" id="297140751">
<object class="NSLayoutManager" key="NSLayoutManager">
<object class="NSTextStorage" key="NSTextStorage">
@@ -8974,7 +8960,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string key="NSFrame">{{1, 1}, {411, 264}}</string>
<reference key="NSSuperview" ref="666283614"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="843242867"/>
<reference key="NSDocView" ref="843242867"/>
<reference key="NSBGColor" ref="449903125"/>
@@ -8986,7 +8971,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{-100, -100}, {11, 133}}</string>
<reference key="NSSuperview" ref="666283614"/>
- <reference key="NSWindow"/>
<int key="NSsFlags">256</int>
<reference key="NSTarget" ref="666283614"/>
<string key="NSAction">_doScroller:</string>
@@ -8997,7 +8981,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{-100, -100}, {87, 18}}</string>
<reference key="NSSuperview" ref="666283614"/>
- <reference key="NSWindow"/>
<int key="NSsFlags">1</int>
<reference key="NSTarget" ref="666283614"/>
<string key="NSAction">_doScroller:</string>
@@ -9007,7 +8990,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string key="NSFrame">{{-1, 42}, {413, 266}}</string>
<reference key="NSSuperview" ref="749598685"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="789153540"/>
<int key="NSsFlags">514</int>
<reference key="NSVScroller" ref="497829974"/>
@@ -9019,7 +9001,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<int key="NSvFlags">260</int>
<string key="NSFrame">{{124, 5}, {76, 28}}</string>
<reference key="NSSuperview" ref="749598685"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="1153515">
<int key="NSCellFlags">67239424</int>
@@ -9038,8 +9019,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
</object>
<string key="NSFrameSize">{411, 341}</string>
- <reference key="NSSuperview"/>
- <reference key="NSWindow"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
<string key="NSMinSize">{350, 222}</string>
@@ -16858,6 +16837,14 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<int key="connectionID">7041</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">tableTriggersInstance</string>
+ <reference key="source" ref="438574515"/>
+ <reference key="destination" ref="33487092"/>
+ </object>
+ <int key="connectionID">7042</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -27152,14 +27139,14 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{925, 531}, {292, 132}}</string>
+ <string>{{710, 531}, {292, 132}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{925, 531}, {292, 132}}</string>
+ <string>{{710, 531}, {292, 132}}</string>
<integer value="1"/>
<integer value="1"/>
<integer value="1"/>
- <string>{292, 112}</string>
- <string>{292, 112}</string>
+ <string>{292, 132}</string>
+ <string>{292, 132}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -27341,7 +27328,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">7041</int>
+ <int key="maxID">7042</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -28973,6 +28960,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>tableNameField</string>
<string>tableSheet</string>
<string>tableSourceInstance</string>
+ <string>tableTriggersInstance</string>
<string>tableTypeButton</string>
<string>tableWindow</string>
<string>tablesListView</string>
@@ -29028,6 +29016,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>id</string>
<string>id</string>
<string>id</string>
+ <string>id</string>
</object>
</object>
<reference key="sourceIdentifier" ref="197237725"/>
@@ -30028,6 +30017,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
+ <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<integer value="1050" key="NS.object.0"/>
@@ -30043,5 +30033,74 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<string key="IBDocument.LastKnownRelativeProjectPath">../../sequel-pro.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
+ <object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>NSActionTemplate</string>
+ <string>NSAddTemplate</string>
+ <string>NSAdvanced</string>
+ <string>NSApplicationIcon</string>
+ <string>NSGoLeftTemplate</string>
+ <string>NSGoRightTemplate</string>
+ <string>NSLeftFacingTriangleTemplate</string>
+ <string>NSListViewTemplate</string>
+ <string>NSMenuCheckmark</string>
+ <string>NSMenuMixedState</string>
+ <string>NSRefreshTemplate</string>
+ <string>NSRightFacingTriangleTemplate</string>
+ <string>NSSwitch</string>
+ <string>button_action</string>
+ <string>button_add</string>
+ <string>button_bar_spacer</string>
+ <string>button_duplicate</string>
+ <string>button_edit</string>
+ <string>button_edit_mode</string>
+ <string>button_edit_mode_selected</string>
+ <string>button_left</string>
+ <string>button_pagination</string>
+ <string>button_pane_hide_icon</string>
+ <string>button_pane_show_icon</string>
+ <string>button_refresh</string>
+ <string>button_remove</string>
+ <string>button_right</string>
+ <string>grabber-horizontal</string>
+ <string>selectall</string>
+ <string>selectnone</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>{10, 10}</string>
+ <string>{8, 8}</string>
+ <string>{32, 32}</string>
+ <string>{128, 128}</string>
+ <string>{9, 9}</string>
+ <string>{9, 9}</string>
+ <string>{9, 9}</string>
+ <string>{11, 10}</string>
+ <string>{9, 8}</string>
+ <string>{7, 2}</string>
+ <string>{10, 12}</string>
+ <string>{9, 9}</string>
+ <string>{15, 15}</string>
+ <string>{32, 23}</string>
+ <string>{32, 23}</string>
+ <string>{10, 23}</string>
+ <string>{33, 23}</string>
+ <string>{32, 23}</string>
+ <string>{32, 23}</string>
+ <string>{32, 23}</string>
+ <string>{32, 23}</string>
+ <string>{32, 23}</string>
+ <string>{11, 10}</string>
+ <string>{11, 10}</string>
+ <string>{32, 23}</string>
+ <string>{32, 23}</string>
+ <string>{32, 23}</string>
+ <string>{10, 8}</string>
+ <string>{14, 17}</string>
+ <string>{14, 17}</string>
+ </object>
+ </object>
</data>
</archive>
diff --git a/Source/SPAppController.m b/Source/SPAppController.m
index f0d4c9bf..f793b93c 100644
--- a/Source/SPAppController.m
+++ b/Source/SPAppController.m
@@ -441,6 +441,7 @@
@"queryHistory",
@"tableColumnWidths",
@"savePath",
+ @"NSRecentDocumentRecords",
nil]];
return preferences;
diff --git a/Source/SPTableData.h b/Source/SPTableData.h
index a63f31dc..88b0a78f 100644
--- a/Source/SPTableData.h
+++ b/Source/SPTableData.h
@@ -64,6 +64,7 @@
- (BOOL) updateInformationForCurrentView;
- (NSDictionary *) informationForView:(NSString *)viewName;
- (BOOL) updateStatusInformationForCurrentTable;
+- (BOOL) updateTriggersForCurrentTable;
- (NSDictionary *) parseFieldDefinitionStringParts:(NSArray *)definitionParts;
- (NSArray *) primaryKeyColumnNames;
diff --git a/Source/SPTableData.m b/Source/SPTableData.m
index 51d490d9..ab1857f6 100644
--- a/Source/SPTableData.m
+++ b/Source/SPTableData.m
@@ -42,8 +42,8 @@
columnNames = [[NSMutableArray alloc] init];
constraints = [[NSMutableArray alloc] init];
status = [[NSMutableDictionary alloc] init];
- triggers = [[NSMutableArray alloc] init];
-
+
+ triggers = nil;
tableEncoding = nil;
tableCreateSyntax = nil;
mySQLConnection = nil;
@@ -121,6 +121,19 @@
- (NSArray *) triggers
{
+
+ // If triggers is nil, the triggers need to be loaded - if a table is selected on MySQL >= 5.0.2
+ if (!triggers) {
+ if ([tableListInstance tableType] == SPTableTypeTable
+ && [mySQLConnection serverMajorVersion] >= 5
+ && [mySQLConnection serverMinorVersion] >= 0)
+ {
+ [self updateTriggersForCurrentTable];
+ } else {
+ return [NSArray array];
+ }
+ }
+
return (NSArray *)triggers;
}
@@ -234,6 +247,11 @@
[columnNames removeAllObjects];
[status removeAllObjects];
+ if (triggers != nil) {
+ [triggers release];
+ triggers = nil;
+ }
+
if (tableEncoding != nil) {
[tableEncoding release];
tableEncoding = nil;
@@ -608,39 +626,12 @@
[createTableParser release];
[fieldParser release];
- // Triggers
- theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"/*!50003 SHOW TRIGGERS WHERE `Table` = %@ */",
- [tableName tickQuotedString]]];
- [theResult setReturnDataAsStrings:YES];
-
- // Check for any errors, but only display them if a connection still exists
- if ([mySQLConnection queryErrored]) {
- if ([mySQLConnection isConnected]) {
- SPBeginAlertSheet(NSLocalizedString(@"Error retrieving table information", @"error retrieving table information message"), NSLocalizedString(@"OK", @"OK button"),
- nil, nil, [NSApp mainWindow], self, nil, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"An error occurred while retrieving the information for table '%@'. Please try again.\n\nMySQL said: %@", @"error retrieving table information informative message"),
- tableName, [mySQLConnection getLastErrorMessage]]);
- }
- [tableColumns release];
- if (encodingString) [encodingString release];
-
- return nil;
- }
-
- [triggers removeAllObjects];
- if( [theResult numOfRows] ) {
- for(i=0; i<[theResult numOfRows]; i++){
- [triggers addObject:[theResult fetchRowAsDictionary]];
- }
- }
-
// this will be 'Table' or 'View'
[tableData setObject:[resultFieldNames objectAtIndex:0] forKey:@"type"];
[tableData setObject:[NSString stringWithString:encodingString] forKey:@"encoding"];
[tableData setObject:[NSArray arrayWithArray:tableColumns] forKey:@"columns"];
[tableData setObject:[NSArray arrayWithArray:constraints] forKey:@"constraints"];
- [tableData setObject:[NSArray arrayWithArray:triggers] forKey:@"triggers"];
[encodingString release];
[tableColumns release];
@@ -878,6 +869,36 @@
return TRUE;
}
+/**
+ * Retrieve the triggers for the current table and add to local cache for reuse.
+ */
+- (BOOL) updateTriggersForCurrentTable
+{
+ MCPResult *theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"/*!50003 SHOW TRIGGERS WHERE `Table` = %@ */",
+ [[tableListInstance tableName] tickQuotedString]]];
+ [theResult setReturnDataAsStrings:YES];
+
+ // Check for any errors, but only display them if a connection still exists
+ if ([mySQLConnection queryErrored]) {
+ if ([mySQLConnection isConnected]) {
+ SPBeginAlertSheet(NSLocalizedString(@"Error retrieving trigger information", @"error retrieving trigger information message"), NSLocalizedString(@"OK", @"OK button"),
+ nil, nil, [NSApp mainWindow], self, nil, nil, nil,
+ [NSString stringWithFormat:NSLocalizedString(@"An error occurred while retrieving the trigger information for table '%@'. Please try again.\n\nMySQL said: %@", @"error retrieving table information informative message"),
+ [tableListInstance tableName], [mySQLConnection getLastErrorMessage]]);
+ if (triggers) [triggers release], triggers = nil;
+ }
+
+ return NO;
+ }
+
+ if (triggers) [triggers release];
+ triggers = [[NSMutableArray alloc] init];
+ for (int i=0; i<[theResult numOfRows]; i++) {
+ [triggers addObject:[theResult fetchRowAsDictionary]];
+ }
+
+ return YES;
+}
/*
* Parse an array of field definition parts - not including name but including type and optionally unsigned/zerofill/null
@@ -1122,9 +1143,9 @@
[columns release];
[columnNames release];
[constraints release];
- [triggers release];
[status release];
+ if (triggers) [triggers release];
if (tableEncoding) [tableEncoding release];
if (tableCreateSyntax) [tableCreateSyntax release];
if (mySQLConnection) [mySQLConnection release];
diff --git a/Source/SPTableTriggers.h b/Source/SPTableTriggers.h
index d492253b..8e97908a 100644
--- a/Source/SPTableTriggers.h
+++ b/Source/SPTableTriggers.h
@@ -57,6 +57,8 @@
@property (readwrite, assign) MCPConnection *connection;
+- (void)loadTriggers;
+
// IB action methods
- (IBAction)addTrigger:(id)sender;
- (IBAction)removeTrigger:(id)sender;
diff --git a/Source/SPTableTriggers.m b/Source/SPTableTriggers.m
index dde516a8..c202e9c9 100644
--- a/Source/SPTableTriggers.m
+++ b/Source/SPTableTriggers.m
@@ -77,12 +77,7 @@
selector:@selector(triggerStatementTextDidChange:)
name:NSTextStorageDidProcessEditingNotification
object:[triggerStatementTextView textStorage]];
-
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(tableSelectionChanged:)
- name:SPTableChangedNotification
- object:tableDocumentInstance];
-
+
// Add observers for document task activity
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(startDocumentTaskForTab:)
@@ -94,6 +89,46 @@
object:tableDocumentInstance];
}
+/**
+ * Called whenever the user selects the triggers tab for the first time,
+ * or switches between tables with the triggers tab active.
+ */
+- (void)loadTriggers
+{
+ BOOL enableInteraction = ((![[tableDocumentInstance selectedToolbarItemIdentifier] isEqualToString:SPMainToolbarTableTriggers]) || (![tableDocumentInstance isWorking]));
+
+ // Disable all interface elements by default
+ [addTriggerButton setEnabled:NO];
+ [refreshTriggersButton setEnabled:NO];
+ [triggersTableView setEnabled:NO];
+ [labelTextField setStringValue:@""];
+
+ // Show a warning if the version of MySQL is too low to support triggers
+ if ([connection serverMajorVersion] < 5
+ || ([connection serverMajorVersion] == 5
+ && [connection serverMinorVersion] == 0
+ && [connection serverReleaseVersion] < 2))
+ {
+ [labelTextField setStringValue:NSLocalizedString(@"This version of MySQL does not support triggers. Support for triggers was added in MySQL 5.0.2", @"triggers not supported label")];
+ return;
+ }
+
+ // If no item is selected, or the item selected is not a table, return.
+ if (![tablesListInstance tableName] || [tablesListInstance tableType] != SPTableTypeTable)
+ return;
+
+ // Update the text label
+ [labelTextField setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Triggers for table: %@", @"triggers for table label"), [tablesListInstance tableName]]];
+
+ // Enable interface elements
+ [addTriggerButton setEnabled:enableInteraction];
+ [refreshTriggersButton setEnabled:enableInteraction];
+ [triggersTableView setEnabled:YES];
+
+ // Ensure trigger data is loaded
+ [self _refreshTriggerDataForcingCacheRefresh:NO];
+}
+
#pragma mark -
#pragma mark IB action methods
@@ -185,49 +220,6 @@
[self _refreshTriggerDataForcingCacheRefresh:YES];
}
-/**
- * Called whenever the user selects a different table.
- */
-- (void)tableSelectionChanged:(NSNotification *)notification
-{
- BOOL enableInteraction = ((![[tableDocumentInstance selectedToolbarItemIdentifier] isEqualToString:SPMainToolbarTableTriggers]) || (![tableDocumentInstance isWorking]));
-
- // To begin enable all interface elements
- [addTriggerButton setEnabled:enableInteraction];
- [refreshTriggersButton setEnabled:enableInteraction];
- [triggersTableView setEnabled:YES];
-
- if (([connection serverMajorVersion] >= 5) &&
- ([connection serverMinorVersion] >= 0) &&
- ([connection serverReleaseVersion] >= 2)) {
-
- // Update the text label
- [labelTextField setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Triggers for table: %@", @"triggers for table label"), [tablesListInstance tableName]]];
-
- [addTriggerButton setEnabled:enableInteraction];
- [refreshTriggersButton setEnabled:enableInteraction];
- [triggersTableView setEnabled:YES];
-
- [self _refreshTriggerDataForcingCacheRefresh:NO];
- }
- else {
- [addTriggerButton setEnabled:NO];
- [refreshTriggersButton setEnabled:NO];
- [triggersTableView setEnabled:NO];
-
- [labelTextField setStringValue:NSLocalizedString(@"This version of MySQL does not support triggers. Support for triggers was added in MySQL 5.0.2", @"triggers not supported label")];
- }
-
- // If a proc or function is selected disable everything.
- if (([tablesListInstance tableType] == SPTableTypeProc) || ([tablesListInstance tableType] == SPTableTypeFunc)) {
- [addTriggerButton setEnabled:NO];
- [refreshTriggersButton setEnabled:NO];
- [triggersTableView setEnabled:NO];
-
- [labelTextField setStringValue:@""];
- }
-}
-
#pragma mark -
#pragma mark Tableview datasource methods
@@ -479,7 +471,10 @@
if ([tablesListInstance tableType] == SPTableTypeTable) {
- if (clearAllCaches) [tableDataInstance updateInformationForCurrentTable];
+ if (clearAllCaches) {
+ [tableDataInstance resetAllData];
+ [tableDataInstance updateTriggersForCurrentTable];
+ }
NSArray *triggers = [tableDataInstance triggers];
diff --git a/Source/TableDump.m b/Source/TableDump.m
index 9f40d90e..004a8e61 100644
--- a/Source/TableDump.m
+++ b/Source/TableDump.m
@@ -1921,52 +1921,52 @@
// Release the result set
[streamingResult release];
+ }
+
+ // Export triggers, if any
+ queryResult = [mySQLConnection queryString:[NSString stringWithFormat:@"/*!50003 SHOW TRIGGERS WHERE `Table` = %@ */;",
+ [tableName tickQuotedString]]];
+ [queryResult setReturnDataAsStrings:YES];
+ if ( [queryResult numOfRows] ) {
+ [metaString setString:@"\n"];
+ [metaString appendString:@"DELIMITER ;;\n"];
- queryResult = [mySQLConnection queryString:[NSString stringWithFormat:@"/*!50003 SHOW TRIGGERS WHERE `Table` = %@ */;",
- [tableName tickQuotedString]]];
- [queryResult setReturnDataAsStrings:YES];
- if ( [queryResult numOfRows] ) {
- [metaString setString:@"\n"];
- [metaString appendString:@"DELIMITER ;;\n"];
+ for (int s=0; s<[queryResult numOfRows]; s++) {
+ NSDictionary *triggers = [[NSDictionary alloc] initWithDictionary:[queryResult fetchRowAsDictionary]];
- for (int s=0; s<[queryResult numOfRows]; s++) {
- NSDictionary *triggers = [[NSDictionary alloc] initWithDictionary:[queryResult fetchRowAsDictionary]];
-
- //Definer is user@host but we need to escape it to `user`@`host`
- NSArray *triggersDefiner = [[triggers objectForKey:@"Definer"] componentsSeparatedByString:@"@"];
- NSString *escapedDefiner = [NSString stringWithFormat:@"%@@%@",
- [[triggersDefiner objectAtIndex:0] backtickQuotedString],
- [[triggersDefiner objectAtIndex:1] backtickQuotedString]
- ];
-
- [metaString appendString:[NSString stringWithFormat:@"/*!50003 SET SESSION SQL_MODE=\"%@\" */;;\n",
- [triggers objectForKey:@"sql_mode"]]];
- [metaString appendString:@"/*!50003 CREATE */ "];
- [metaString appendString:[NSString stringWithFormat:@"/*!50017 DEFINER=%@ */ ",
- escapedDefiner]];
- [metaString appendString:[NSString stringWithFormat:@"/*!50003 TRIGGER %@ %@ %@ ON %@ FOR EACH ROW %@ */;;\n",
- [[triggers objectForKey:@"Trigger"] backtickQuotedString],
- [triggers objectForKey:@"Timing"],
- [triggers objectForKey:@"Event"],
- [[triggers objectForKey:@"Table"] backtickQuotedString],
- [triggers objectForKey:@"Statement"]
- ]];
- [triggers release];
- }
+ //Definer is user@host but we need to escape it to `user`@`host`
+ NSArray *triggersDefiner = [[triggers objectForKey:@"Definer"] componentsSeparatedByString:@"@"];
+ NSString *escapedDefiner = [NSString stringWithFormat:@"%@@%@",
+ [[triggersDefiner objectAtIndex:0] backtickQuotedString],
+ [[triggersDefiner objectAtIndex:1] backtickQuotedString]
+ ];
- [metaString appendString:@"DELIMITER ;\n"];
- [metaString appendString:@"/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;\n"];
- [fileHandle writeData:[metaString dataUsingEncoding:NSUTF8StringEncoding]];
+ [metaString appendString:[NSString stringWithFormat:@"/*!50003 SET SESSION SQL_MODE=\"%@\" */;;\n",
+ [triggers objectForKey:@"sql_mode"]]];
+ [metaString appendString:@"/*!50003 CREATE */ "];
+ [metaString appendString:[NSString stringWithFormat:@"/*!50017 DEFINER=%@ */ ",
+ escapedDefiner]];
+ [metaString appendString:[NSString stringWithFormat:@"/*!50003 TRIGGER %@ %@ %@ ON %@ FOR EACH ROW %@ */;;\n",
+ [[triggers objectForKey:@"Trigger"] backtickQuotedString],
+ [triggers objectForKey:@"Timing"],
+ [triggers objectForKey:@"Event"],
+ [[triggers objectForKey:@"Table"] backtickQuotedString],
+ [triggers objectForKey:@"Statement"]
+ ]];
+ [triggers release];
}
- if ([mySQLConnection queryErrored]) {
- [errors appendString:[NSString stringWithFormat:@"%@\n", [mySQLConnection getLastErrorMessage]]];
- if ( [addErrorsSwitch state] == NSOnState ) {
- [fileHandle writeData:[[NSString stringWithFormat:@"# Error: %@\n", [mySQLConnection getLastErrorMessage]]
- dataUsingEncoding:NSUTF8StringEncoding]];
- }
+ [metaString appendString:@"DELIMITER ;\n"];
+ [metaString appendString:@"/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;\n"];
+ [fileHandle writeData:[metaString dataUsingEncoding:NSUTF8StringEncoding]];
+ }
+
+ if ([mySQLConnection queryErrored]) {
+ [errors appendString:[NSString stringWithFormat:@"%@\n", [mySQLConnection getLastErrorMessage]]];
+ if ( [addErrorsSwitch state] == NSOnState ) {
+ [fileHandle writeData:[[NSString stringWithFormat:@"# Error: %@\n", [mySQLConnection getLastErrorMessage]]
+ dataUsingEncoding:NSUTF8StringEncoding]];
}
-
}
// Add an additional separator between tables
diff --git a/Source/TablesList.h b/Source/TablesList.h
index 5c6ccf96..36d3ccaa 100644
--- a/Source/TablesList.h
+++ b/Source/TablesList.h
@@ -48,6 +48,7 @@
IBOutlet id extendedTableInfoInstance;
IBOutlet id databaseDataInstance;
IBOutlet id tableInfoInstance;
+ IBOutlet id tableTriggersInstance;
IBOutlet SPHistoryController *spHistoryControllerInstance;
IBOutlet id tableWindow;
@@ -102,7 +103,7 @@
BOOL tableListIsSelectable;
BOOL tableListContainsViews;
- BOOL structureLoaded, contentLoaded, statusLoaded, alertSheetOpened;
+ BOOL structureLoaded, contentLoaded, statusLoaded, triggersLoaded, alertSheetOpened;
}
// IBAction methods
diff --git a/Source/TablesList.m b/Source/TablesList.m
index e39da649..15def773 100644
--- a/Source/TablesList.m
+++ b/Source/TablesList.m
@@ -693,40 +693,35 @@
// Restore view states as appropriate
[spHistoryControllerInstance restoreViewStates];
+ structureLoaded = NO;
+ contentLoaded = NO;
+ statusLoaded = NO;
+ triggersLoaded = NO;
if( selectedTableType == SPTableTypeView || selectedTableType == SPTableTypeTable) {
if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 0 ) {
[tableSourceInstance loadTable:selectedTableName];
structureLoaded = YES;
- contentLoaded = NO;
- statusLoaded = NO;
} else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 1 ) {
if(tableEncoding == nil) {
[tableContentInstance loadTable:nil];
} else {
[tableContentInstance loadTable:selectedTableName];
}
- structureLoaded = NO;
contentLoaded = YES;
- statusLoaded = NO;
} else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 3 ) {
- [extendedTableInfoInstance performSelectorOnMainThread:@selector(loadTable:) withObject:selectedTableName waitUntilDone:YES];
- structureLoaded = NO;
- contentLoaded = NO;
+ [[extendedTableInfoInstance onMainThread] loadTable:selectedTableName];
statusLoaded = YES;
- } else {
- structureLoaded = NO;
- contentLoaded = NO;
- statusLoaded = NO;
+ } else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 5 ) {
+ [[tableTriggersInstance onMainThread] loadTriggers];
+ triggersLoaded = YES;
}
} else {
// if we are not looking at a table or view, clear these
[tableSourceInstance loadTable:nil];
[tableContentInstance loadTable:nil];
- [extendedTableInfoInstance performSelectorOnMainThread:@selector(loadTable:) withObject:nil waitUntilDone:YES];
- structureLoaded = NO;
- contentLoaded = NO;
- statusLoaded = NO;
+ [[extendedTableInfoInstance onMainThread] loadTable:nil];
+ [[tableTriggersInstance onMainThread] loadTriggers];
}
// Update the "Show Create Syntax" window if it's already opened
@@ -769,10 +764,12 @@
[tableSourceInstance loadTable:nil];
[tableContentInstance loadTable:nil];
[extendedTableInfoInstance loadTable:nil];
+ [tableTriggersInstance loadTriggers];
structureLoaded = NO;
contentLoaded = NO;
statusLoaded = NO;
+ triggersLoaded = NO;
// Set gear menu items Remove/Duplicate table/view according to the table types
// if at least one item is selected
@@ -1358,24 +1355,27 @@
// if the 'table' is a view or a table, reload the currently selected view
if (selectedTableType == SPTableTypeTable || selectedTableType == SPTableTypeView)
{
+ statusLoaded = NO;
+ structureLoaded = NO;
+ contentLoaded = NO;
+ triggersLoaded = NO;
switch ([tabView indexOfTabViewItem:[tabView selectedTabViewItem]]) {
case 0:
[tableSourceInstance loadTable:newTableName];
structureLoaded = YES;
- contentLoaded = statusLoaded = NO;
break;
case 1:
[tableContentInstance loadTable:newTableName];
contentLoaded = YES;
- structureLoaded = statusLoaded = NO;
break;
case 3:
[extendedTableInfoInstance loadTable:newTableName];
statusLoaded = YES;
- structureLoaded = contentLoaded = NO;
break;
- default:
- statusLoaded = structureLoaded = contentLoaded = NO;
+ case 5:
+ [tableTriggersInstance loadTriggers];
+ triggersLoaded = YES;
+ break;
}
}
}
@@ -1560,8 +1560,9 @@
{
NSAutoreleasePool *tabLoadPool = [[NSAutoreleasePool alloc] init];
- if ( [tablesListView numberOfSelectedRows] == 1 &&
- ([self tableType] == SPTableTypeTable || [self tableType] == SPTableTypeView) ) {
+ if ([tablesListView numberOfSelectedRows] == 1
+ && ([self tableType] == SPTableTypeTable || [self tableType] == SPTableTypeView) )
+ {
if ( ([tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 0) && !structureLoaded ) {
[tableSourceInstance loadTable:selectedTableName];
@@ -1574,9 +1575,14 @@
}
if ( ([tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 3) && !statusLoaded ) {
- [extendedTableInfoInstance performSelectorOnMainThread:@selector(loadTable:) withObject:selectedTableName waitUntilDone:YES];
+ [[extendedTableInfoInstance onMainThread] loadTable:selectedTableName];
statusLoaded = YES;
}
+
+ if ( ([tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 5) && !triggersLoaded ) {
+ [[tableTriggersInstance onMainThread] loadTriggers];
+ triggersLoaded = YES;
+ }
}
else {
[tableSourceInstance loadTable:nil];
@@ -1805,6 +1811,7 @@
structureLoaded = NO;
contentLoaded = NO;
statusLoaded = NO;
+ triggersLoaded = NO;
isTableListFiltered = NO;
tableListIsSelectable = YES;
tableListContainsViews = NO;