diff options
author | stuconnolly <stuart02@gmail.com> | 2009-11-14 13:23:17 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2009-11-14 13:23:17 +0000 |
commit | ffab593752dd8fbd56f7eeb0f7fa666a938ba774 (patch) | |
tree | 692fb5c1a551bda9e9289725382de3fc0a71c706 | |
parent | a4a502eedaf862dce9f22108a5f9a1454b76d72c (diff) | |
download | sequelpro-ffab593752dd8fbd56f7eeb0f7fa666a938ba774.tar.gz sequelpro-ffab593752dd8fbd56f7eeb0f7fa666a938ba774.tar.bz2 sequelpro-ffab593752dd8fbd56f7eeb0f7fa666a938ba774.zip |
Bunch of improvements to the query console, including:
- New connection column (been meaning to add this for a while)
- Display table view column headers
- Enable table view text cell line truncating
- Allow table view columns to be re-ordered
- The table view now respects the display table view vertical grid lines preference
- Support for including the connection when saving messages to a file
- Support for showing/hiding the connection column
- Increase table view row height to match that of all others
- Display message time stamps using the user's system wide medium time format
-rw-r--r-- | Interfaces/English.lproj/Console.xib | 314 | ||||
-rw-r--r-- | Interfaces/English.lproj/Localizable.strings | bin | 103628 -> 107096 bytes | |||
-rw-r--r-- | Resources/PreferenceDefaults.plist | 2 | ||||
-rw-r--r-- | Source/SPConnectionDelegate.m | 4 | ||||
-rw-r--r-- | Source/SPConsoleMessage.h | 7 | ||||
-rw-r--r-- | Source/SPConsoleMessage.m | 20 | ||||
-rw-r--r-- | Source/SPConstants.h | 1 | ||||
-rw-r--r-- | Source/SPConstants.m | 1 | ||||
-rw-r--r-- | Source/SPProcessListController.m | 2 | ||||
-rw-r--r-- | Source/SPQueryController.h | 13 | ||||
-rw-r--r-- | Source/SPQueryController.m | 247 | ||||
-rw-r--r-- | Source/SPServerVariablesController.m | 2 | ||||
-rw-r--r-- | Source/TableContent.m | 2 | ||||
-rw-r--r-- | Source/TableDocument.h | 2 | ||||
-rw-r--r-- | Source/TableDocument.m | 3 |
15 files changed, 428 insertions, 192 deletions
diff --git a/Interfaces/English.lproj/Console.xib b/Interfaces/English.lproj/Console.xib index b9ee7d4e..d84c24b5 100644 --- a/Interfaces/English.lproj/Console.xib +++ b/Interfaces/English.lproj/Console.xib @@ -12,7 +12,8 @@ </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="7"/> + <integer value="49"/> + <integer value="79"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -200,25 +201,33 @@ <object class="NSTableView" id="243353733"> <reference key="NSNextResponder" ref="264199078"/> <int key="NSvFlags">256</int> - <string key="NSFrameSize">{575, 142}</string> + <string key="NSFrameSize">{576, 126}</string> <reference key="NSSuperview" ref="264199078"/> <bool key="NSEnabled">YES</bool> - <object class="_NSCornerView" key="NSCornerView"> - <nil key="NSNextResponder"/> + <object class="NSTableHeaderView" key="NSHeaderView" id="1007693691"> + <reference key="NSNextResponder" ref="486423323"/> + <int key="NSvFlags">256</int> + <string key="NSFrameSize">{576, 17}</string> + <reference key="NSSuperview" ref="486423323"/> + <reference key="NSTableView" ref="243353733"/> + </object> + <object class="_NSCornerView" key="NSCornerView" id="523501585"> + <reference key="NSNextResponder" ref="865703622"/> <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{-26, 0}, {16, 17}}</string> + <reference key="NSSuperview" ref="865703622"/> </object> <object class="NSMutableArray" key="NSTableColumns"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSTableColumn" id="424669154"> <string key="NSIdentifier">messageDate</string> - <double key="NSWidth">145</double> + <double key="NSWidth">100</double> <double key="NSMinWidth">50</double> <double key="NSMaxWidth">1000</double> <object class="NSTableHeaderCell" key="NSHeaderCell"> <int key="NSCellFlags">75628096</int> <int key="NSCellFlags2">2048</int> - <string key="NSContents"/> + <string key="NSContents">Time</string> <reference key="NSSupport" ref="26"/> <object class="NSColor" key="NSBackgroundColor"> <int key="NSColorSpace">3</int> @@ -233,7 +242,7 @@ </object> <object class="NSTextFieldCell" key="NSDataCell" id="353829655"> <int key="NSCellFlags">67239488</int> - <int key="NSCellFlags2">133120</int> + <int key="NSCellFlags2">133376</int> <string key="NSContents">Text Cell</string> <reference key="NSSupport" ref="26"/> <reference key="NSControlView" ref="243353733"/> @@ -248,19 +257,21 @@ </object> <reference key="NSTextColor" ref="22056724"/> </object> + <int key="NSResizingMask">3</int> + <bool key="NSIsResizeable">YES</bool> <reference key="NSTableView" ref="243353733"/> </object> - <object class="NSTableColumn" id="781897583"> - <string key="NSIdentifier">message</string> - <double key="NSWidth">424</double> - <double key="NSMinWidth">10</double> - <double key="NSMaxWidth">3.4028230607370965e+38</double> + <object class="NSTableColumn" id="925890526"> + <string key="NSIdentifier">messageConnection</string> + <double key="NSWidth">100</double> + <double key="NSMinWidth">50</double> + <double key="NSMaxWidth">1000</double> <object class="NSTableHeaderCell" key="NSHeaderCell"> <int key="NSCellFlags">75628096</int> <int key="NSCellFlags2">2048</int> - <string key="NSContents"/> + <string key="NSContents">Connection</string> <reference key="NSSupport" ref="26"/> - <object class="NSColor" key="NSBackgroundColor"> + <object class="NSColor" key="NSBackgroundColor" id="170782334"> <int key="NSColorSpace">6</int> <string key="NSCatalogName">System</string> <string key="NSColorName">headerColor</string> @@ -268,9 +279,35 @@ </object> <reference key="NSTextColor" ref="489725497"/> </object> + <object class="NSTextFieldCell" key="NSDataCell" id="293601307"> + <int key="NSCellFlags">337772096</int> + <int key="NSCellFlags2">133376</int> + <string key="NSContents">Text Cell</string> + <reference key="NSSupport" ref="26"/> + <reference key="NSControlView" ref="243353733"/> + <reference key="NSBackgroundColor" ref="357371173"/> + <reference key="NSTextColor" ref="22056724"/> + </object> + <int key="NSResizingMask">3</int> + <bool key="NSIsResizeable">YES</bool> + <reference key="NSTableView" ref="243353733"/> + </object> + <object class="NSTableColumn" id="781897583"> + <string key="NSIdentifier">message</string> + <double key="NSWidth">367</double> + <double key="NSMinWidth">10</double> + <double key="NSMaxWidth">1000</double> + <object class="NSTableHeaderCell" key="NSHeaderCell"> + <int key="NSCellFlags">75628096</int> + <int key="NSCellFlags2">2048</int> + <string key="NSContents">Query</string> + <reference key="NSSupport" ref="26"/> + <reference key="NSBackgroundColor" ref="170782334"/> + <reference key="NSTextColor" ref="489725497"/> + </object> <object class="NSTextFieldCell" key="NSDataCell" id="973993322"> <int key="NSCellFlags">67239488</int> - <int key="NSCellFlags2">133120</int> + <int key="NSCellFlags2">133376</int> <string key="NSContents">Text Cell</string> <reference key="NSSupport" ref="26"/> <reference key="NSControlView" ref="243353733"/> @@ -295,7 +332,7 @@ </object> </object> <double key="NSRowHeight">16</double> - <int key="NSTvFlags">440401920</int> + <int key="NSTvFlags">-633339904</int> <reference key="NSDelegate"/> <reference key="NSDataSource"/> <int key="NSColumnAutoresizingStyle">4</int> @@ -305,7 +342,7 @@ <int key="NSTableViewDraggingDestinationStyle">0</int> </object> </object> - <string key="NSFrame">{{1, 1}, {575, 142}}</string> + <string key="NSFrame">{{1, 17}, {576, 126}}</string> <reference key="NSSuperview" ref="865703622"/> <reference key="NSNextKeyView" ref="243353733"/> <reference key="NSDocView" ref="243353733"/> @@ -319,7 +356,7 @@ <reference key="NSSuperview" ref="865703622"/> <reference key="NSTarget" ref="865703622"/> <string key="NSAction">_doScroller:</string> - <double key="NSPercent">0.99199998378753662</double> + <double key="NSPercent">0.9921259880065918</double> </object> <object class="NSScroller" id="444118053"> <reference key="NSNextResponder" ref="865703622"/> @@ -331,14 +368,31 @@ <string key="NSAction">_doScroller:</string> <double key="NSPercent">0.57142859697341919</double> </object> + <object class="NSClipView" id="486423323"> + <reference key="NSNextResponder" ref="865703622"/> + <int key="NSvFlags">2304</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="1007693691"/> + </object> + <string key="NSFrame">{{1, 0}, {576, 17}}</string> + <reference key="NSSuperview" ref="865703622"/> + <reference key="NSNextKeyView" ref="1007693691"/> + <reference key="NSDocView" ref="1007693691"/> + <reference key="NSBGColor" ref="357371173"/> + <int key="NScvFlags">4</int> + </object> + <reference ref="523501585"/> </object> - <string key="NSFrame">{{-1, 22}, {577, 144}}</string> + <string key="NSFrame">{{-1, 22}, {578, 144}}</string> <reference key="NSSuperview" ref="215475093"/> <reference key="NSNextKeyView" ref="264199078"/> <int key="NSsFlags">530</int> <reference key="NSVScroller" ref="464398489"/> <reference key="NSHScroller" ref="444118053"/> <reference key="NSContentView" ref="264199078"/> + <reference key="NSHeaderClipView" ref="486423323"/> + <reference key="NSCornerView" ref="523501585"/> <bytes key="NSScrollAmts">QSAAAEEgAABBkAAAQZAAAA</bytes> </object> <object class="NSProgressIndicator" id="223792049"> @@ -418,7 +472,7 @@ <reference ref="97098983"/> <object class="NSMenuItem" id="77378686"> <reference key="NSMenu" ref="636769899"/> - <string key="NSTitle">Show time stamps</string> + <string key="NSTitle">Show Time Stamps</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <int key="NSState">1</int> @@ -433,9 +487,32 @@ <string key="NSAction">_popUpItemAction:</string> <reference key="NSTarget" ref="146997448"/> </object> + <object class="NSMenuItem" id="825047486"> + <reference key="NSMenu" ref="636769899"/> + <string key="NSTitle">Show Connections</string> + <string key="NSKeyEquiv"/> + <int key="NSMnemonicLoc">2147483647</int> + <int key="NSState">1</int> + <reference key="NSOnImage" ref="896081251"/> + <reference key="NSMixedImage" ref="235191893"/> + <string key="NSAction">_popUpItemAction:</string> + <reference key="NSTarget" ref="146997448"/> + </object> + <object class="NSMenuItem" id="388274540"> + <reference key="NSMenu" ref="636769899"/> + <bool key="NSIsDisabled">YES</bool> + <bool key="NSIsSeparator">YES</bool> + <string key="NSTitle"/> + <string key="NSKeyEquiv"/> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="896081251"/> + <reference key="NSMixedImage" ref="235191893"/> + <string key="NSAction">_popUpItemAction:</string> + <reference key="NSTarget" ref="146997448"/> + </object> <object class="NSMenuItem" id="435045502"> <reference key="NSMenu" ref="636769899"/> - <string key="NSTitle">Show SELECT/SHOW statements</string> + <string key="NSTitle">Show SELECT/SHOW Statements</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <int key="NSState">1</int> @@ -446,7 +523,7 @@ </object> <object class="NSMenuItem" id="60345708"> <reference key="NSMenu" ref="636769899"/> - <string key="NSTitle">Show HELP statements</string> + <string key="NSTitle">Show HELP Statements</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <int key="NSState">1</int> @@ -457,7 +534,7 @@ </object> </object> </object> - <int key="NSSelectedIndex">1</int> + <int key="NSSelectedIndex">4</int> <bool key="NSPullDown">YES</bool> <int key="NSPreferredEdge">1</int> <bool key="NSUsesItemFromMenu">YES</bool> @@ -495,29 +572,29 @@ <string key="NSFrameAutosaveName"/> </object> <object class="NSCustomView" id="841319465"> - <nil key="NSNextResponder"/> + <reference key="NSNextResponder"/> <int key="NSvFlags">268</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSButton" id="296628662"> + <object class="NSButton" id="926588109"> <reference key="NSNextResponder" ref="841319465"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{10, 6}, {150, 18}}</string> + <string key="NSFrame">{{10, 6}, {151, 18}}</string> <reference key="NSSuperview" ref="841319465"/> <bool key="NSEnabled">YES</bool> - <object class="NSButtonCell" key="NSCell" id="640143248"> + <object class="NSButtonCell" key="NSCell" id="570624841"> <int key="NSCellFlags">-2080244224</int> <int key="NSCellFlags2">0</int> - <string key="NSContents">Include time stamps</string> + <string key="NSContents">Include Connections</string> <reference key="NSSupport" ref="1012436895"/> - <reference key="NSControlView" ref="296628662"/> + <reference key="NSControlView" ref="926588109"/> <int key="NSButtonFlags">1211912703</int> - <int key="NSButtonFlags2">130</int> - <object class="NSCustomResource" key="NSNormalImage"> + <int key="NSButtonFlags2">2</int> + <object class="NSCustomResource" key="NSNormalImage" id="882388873"> <string key="NSClassName">NSImage</string> <string key="NSResourceName">NSSwitch</string> </object> - <object class="NSButtonImageSource" key="NSAlternateImage"> + <object class="NSButtonImageSource" key="NSAlternateImage" id="841662284"> <string key="NSImageName">NSSwitch</string> </object> <string key="NSAlternateContents"/> @@ -526,8 +603,31 @@ <int key="NSPeriodicInterval">25</int> </object> </object> + <object class="NSButton" id="296628662"> + <reference key="NSNextResponder" ref="841319465"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{10, 30}, {154, 18}}</string> + <reference key="NSSuperview" ref="841319465"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="640143248"> + <int key="NSCellFlags">-2080244224</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">Include Time Stamps</string> + <reference key="NSSupport" ref="1012436895"/> + <reference key="NSControlView" ref="296628662"/> + <int key="NSButtonFlags">1211912703</int> + <int key="NSButtonFlags2">2</int> + <reference key="NSNormalImage" ref="882388873"/> + <reference key="NSAlternateImage" ref="841662284"/> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> </object> - <string key="NSFrameSize">{170, 30}</string> + <string key="NSFrameSize">{178, 54}</string> + <reference key="NSSuperview"/> <string key="NSClassName">NSView</string> </object> <object class="NSMenu" id="1011399888"> @@ -545,6 +645,10 @@ </object> </object> <object class="NSUserDefaultsController" id="320962651"> + <object class="NSMutableArray" key="NSDeclaredKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>SPConsoleShowTimestamps</string> + </object> <bool key="NSSharedInstance">YES</bool> </object> </object> @@ -680,22 +784,6 @@ <int key="connectionID">85</int> </object> <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> - <string key="label">showTimeStampsMenuItem</string> - <reference key="source" ref="1001"/> - <reference key="destination" ref="77378686"/> - </object> - <int key="connectionID">86</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> - <string key="label">showSelectShowStatementsMenuItem</string> - <reference key="source" ref="1001"/> - <reference key="destination" ref="435045502"/> - </object> - <int key="connectionID">87</int> - </object> - <object class="IBConnectionRecord"> <object class="IBBindingConnection" key="connection"> <string key="label">value: values.ConsoleShowSelectsAndShows</string> <reference key="source" ref="435045502"/> @@ -752,14 +840,6 @@ <int key="connectionID">104</int> </object> <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> - <string key="label">showHelpMenuItem</string> - <reference key="source" ref="1001"/> - <reference key="destination" ref="60345708"/> - </object> - <int key="connectionID">105</int> - </object> - <object class="IBConnectionRecord"> <object class="IBBindingConnection" key="connection"> <string key="label">value: values.ConsoleShowHelps</string> <reference key="source" ref="60345708"/> @@ -783,6 +863,38 @@ </object> <int key="connectionID">110</int> </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">includeConnectionButton</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="926588109"/> + </object> + <int key="connectionID">117</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">toggleShowConnections:</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="825047486"/> + </object> + <int key="connectionID">119</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">value: values.SPConsoleShowTimestamps</string> + <reference key="source" ref="825047486"/> + <reference key="destination" ref="320962651"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="825047486"/> + <reference key="NSDestination" ref="320962651"/> + <string key="NSLabel">value: values.SPConsoleShowTimestamps</string> + <string key="NSBinding">value</string> + <string key="NSKeyPath">values.SPConsoleShowTimestamps</string> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">121</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -826,7 +938,6 @@ <reference key="object" ref="215475093"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="865703622"/> <reference ref="139811820"/> <reference ref="919154377"/> <reference ref="688790145"/> @@ -834,6 +945,7 @@ <reference ref="591384017"/> <reference ref="544468485"/> <reference ref="301104034"/> + <reference ref="865703622"/> </object> <reference key="parent" ref="209913341"/> </object> @@ -845,6 +957,7 @@ <reference ref="243353733"/> <reference ref="444118053"/> <reference ref="464398489"/> + <reference ref="1007693691"/> </object> <reference key="parent" ref="215475093"/> </object> @@ -881,8 +994,9 @@ <reference key="object" ref="243353733"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="781897583"/> <reference ref="424669154"/> + <reference ref="925890526"/> + <reference ref="781897583"/> </object> <reference key="parent" ref="865703622"/> </object> @@ -930,6 +1044,7 @@ <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="296628662"/> + <reference ref="926588109"/> </object> <reference key="parent" ref="0"/> <string key="objectName">saveLogView</string> @@ -1022,6 +1137,8 @@ <reference ref="435045502"/> <reference ref="97098983"/> <reference ref="60345708"/> + <reference ref="388274540"/> + <reference ref="825047486"/> </object> <reference key="parent" ref="146997448"/> </object> @@ -1064,6 +1181,49 @@ <reference key="object" ref="1054523894"/> <reference key="parent" ref="301104034"/> </object> + <object class="IBObjectRecord"> + <int key="objectID">111</int> + <reference key="object" ref="388274540"/> + <reference key="parent" ref="636769899"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">112</int> + <reference key="object" ref="1007693691"/> + <reference key="parent" ref="865703622"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">113</int> + <reference key="object" ref="925890526"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="293601307"/> + </object> + <reference key="parent" ref="243353733"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">114</int> + <reference key="object" ref="293601307"/> + <reference key="parent" ref="925890526"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">115</int> + <reference key="object" ref="926588109"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="570624841"/> + </object> + <reference key="parent" ref="841319465"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">116</int> + <reference key="object" ref="570624841"/> + <reference key="parent" ref="926588109"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">118</int> + <reference key="object" ref="825047486"/> + <reference key="parent" ref="636769899"/> + </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> @@ -1076,6 +1236,10 @@ <string>103.IBPluginDependency</string> <string>108.IBPluginDependency</string> <string>109.IBPluginDependency</string> + <string>111.IBPluginDependency</string> + <string>115.IBPluginDependency</string> + <string>116.IBPluginDependency</string> + <string>118.IBPluginDependency</string> <string>12.IBPluginDependency</string> <string>13.IBPluginDependency</string> <string>14.IBPluginDependency</string> @@ -1132,13 +1296,17 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{341, 238}, {575, 203}}</string> - <string>{{341, 238}, {575, 203}}</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>{{277, 574}, {575, 203}}</string> + <string>{{277, 574}, {575, 203}}</string> <boolean value="NO"/> <boolean value="YES"/> <string>{575, 130}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{568, 643}, {170, 30}}</string> + <string>{{568, 619}, {178, 54}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -1159,7 +1327,7 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{319, 180}, {286, 83}}</string> + <string>{{255, 481}, {283, 118}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <object class="NSMutableDictionary"> @@ -1200,7 +1368,7 @@ </object> </object> <nil key="sourceID"/> - <int key="maxID">110</int> + <int key="maxID">121</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -1282,6 +1450,7 @@ <string>clearConsole:</string> <string>copy:</string> <string>saveConsoleAs:</string> + <string>toggleShowConnections:</string> <string>toggleShowHelpStatements:</string> <string>toggleShowSelectShowStatements:</string> <string>toggleShowTimeStamps:</string> @@ -1294,6 +1463,7 @@ <string>id</string> <string>id</string> <string>id</string> + <string>id</string> </object> </object> <object class="NSMutableDictionary" key="outlets"> @@ -1303,14 +1473,12 @@ <string>clearConsoleButton</string> <string>consoleSearchField</string> <string>consoleTableView</string> + <string>includeConnectionButton</string> <string>includeTimeStampsButton</string> <string>loggingDisabledTextField</string> <string>progressIndicator</string> <string>saveConsoleButton</string> <string>saveLogView</string> - <string>showHelpMenuItem</string> - <string>showSelectShowStatementsMenuItem</string> - <string>showTimeStampsMenuItem</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -1318,13 +1486,11 @@ <string>NSSearchField</string> <string>NSTableView</string> <string>NSButton</string> + <string>NSButton</string> <string>NSTextField</string> <string>NSProgressIndicator</string> <string>NSButton</string> <string>NSView</string> - <string>NSMenuItem</string> - <string>NSMenuItem</string> - <string>NSMenuItem</string> </object> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> @@ -1897,6 +2063,14 @@ </object> </object> <object class="IBPartialClassDescription"> + <string key="className">NSTableHeaderView</string> + <string key="superclassName">NSView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSTableHeaderView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> <string key="className">NSTableView</string> <string key="superclassName">NSControl</string> <reference key="sourceIdentifier" ref="1006895098"/> diff --git a/Interfaces/English.lproj/Localizable.strings b/Interfaces/English.lproj/Localizable.strings Binary files differindex f7333112..6ff1bb17 100644 --- a/Interfaces/English.lproj/Localizable.strings +++ b/Interfaces/English.lproj/Localizable.strings diff --git a/Resources/PreferenceDefaults.plist b/Resources/PreferenceDefaults.plist index 8492b3aa..ac28192c 100644 --- a/Resources/PreferenceDefaults.plist +++ b/Resources/PreferenceDefaults.plist @@ -102,6 +102,8 @@ <true/> <key>ConsoleShowTimestamps</key> <true/> + <key>ConsoleShowConnections</key> + <true/> <key>ConsoleShowSelectsAndShows</key> <true/> <key>ConsoleShowHelps</key> diff --git a/Source/SPConnectionDelegate.m b/Source/SPConnectionDelegate.m index e306c497..ca0378b3 100644 --- a/Source/SPConnectionDelegate.m +++ b/Source/SPConnectionDelegate.m @@ -44,7 +44,7 @@ || (_queryMode == SPCustomQueryQueryMode && [prefs boolForKey:SPConsoleEnableCustomQueryLogging]) || (_queryMode == SPImportExportQueryMode && [prefs boolForKey:SPConsoleEnableImportExportLogging])) { - [[SPQueryController sharedQueryController] showMessageInConsole:query]; + [[SPQueryController sharedQueryController] showMessageInConsole:query connection:[self name]]; } } } @@ -55,7 +55,7 @@ - (void)queryGaveError:(NSString *)error connection:(id)connection { if ([prefs boolForKey:SPConsoleEnableLogging] && [prefs boolForKey:SPConsoleEnableErrorLogging]) { - [[SPQueryController sharedQueryController] showErrorInConsole:error]; + [[SPQueryController sharedQueryController] showErrorInConsole:error connection:[self name]]; } } diff --git a/Source/SPConsoleMessage.h b/Source/SPConsoleMessage.h index fff96276..d78c4f09 100644 --- a/Source/SPConsoleMessage.h +++ b/Source/SPConsoleMessage.h @@ -29,15 +29,18 @@ { BOOL isError; NSDate *messageDate; + NSString *message; + NSString *messageConnection; } @property (readwrite, assign) BOOL isError; @property (readwrite, retain) NSDate *messageDate; @property (readwrite, retain) NSString *message; +@property (readwrite, retain) NSString *messageConnection; -+ (SPConsoleMessage *)consoleMessageWithMessage:(NSString *)consoleMessage date:(NSDate *)date; ++ (SPConsoleMessage *)consoleMessageWithMessage:(NSString *)consoleMessage date:(NSDate *)date connection:(NSString *)connection; -- (id)initWithMessage:(NSString *)message date:(NSDate *)date; +- (id)initWithMessage:(NSString *)message date:(NSDate *)date connection:(NSString *)connection; @end diff --git a/Source/SPConsoleMessage.m b/Source/SPConsoleMessage.m index 25a00e9b..e851a9ef 100644 --- a/Source/SPConsoleMessage.m +++ b/Source/SPConsoleMessage.m @@ -30,26 +30,38 @@ @synthesize isError; @synthesize messageDate; @synthesize message; +@synthesize messageConnection; -+ (SPConsoleMessage *)consoleMessageWithMessage:(NSString *)message date:(NSDate *)date +/** + * + */ ++ (SPConsoleMessage *)consoleMessageWithMessage:(NSString *)message date:(NSDate *)date connection:(NSString *)connection { - return [[[SPConsoleMessage alloc] initWithMessage:message date:date] autorelease]; + return [[[SPConsoleMessage alloc] initWithMessage:message date:date connection:connection] autorelease]; } -- (id)initWithMessage:(NSString *)consoleMessage date:(NSDate *)date +/** + * + */ +- (id)initWithMessage:(NSString *)consoleMessage date:(NSDate *)date connection:(NSString *)connection { if ((self = [super init])) { - [self setMessage:consoleMessage]; [self setMessageDate:date]; + [self setMessage:consoleMessage]; + [self setMessageConnection:connection]; } return self; } +/** + * Dealloc. + */ - (void)dealloc { [message release], message = nil; [messageDate release], messageDate = nil; + [messageConnection release], messageConnection = nil; [super dealloc]; } diff --git a/Source/SPConstants.h b/Source/SPConstants.h index fa5e0e85..3c40fc66 100644 --- a/Source/SPConstants.h +++ b/Source/SPConstants.h @@ -143,6 +143,7 @@ extern NSString *SPLastUsedVersion; // GUI Prefs extern NSString *SPConsoleShowTimestamps; +extern NSString *SPConsoleShowConnections; extern NSString *SPConsoleShowSelectsAndShows; extern NSString *SPConsoleShowHelps; extern NSString *SPEditInSheetEnabled; diff --git a/Source/SPConstants.m b/Source/SPConstants.m index 188a6282..4cafc02e 100644 --- a/Source/SPConstants.m +++ b/Source/SPConstants.m @@ -96,6 +96,7 @@ NSString *SPLastUsedVersion = @"LastUsedVersion"; NSString *SPConsoleShowHelps = @"ConsoleShowHelps"; NSString *SPConsoleShowSelectsAndShows = @"ConsoleShowSelectsAndShows"; NSString *SPConsoleShowTimestamps = @"ConsoleShowTimestamps"; +NSString *SPConsoleShowConnections = @"ConsoleShowConnections"; NSString *SPEditInSheetEnabled = @"EditInSheetEnabled"; NSString *SPTableInformationPanelCollapsed = @"TableInformationPanelCollapsed"; NSString *SPTableColumnWidths = @"tableColumnWidths"; diff --git a/Source/SPProcessListController.m b/Source/SPProcessListController.m index af160177..864bccc3 100644 --- a/Source/SPProcessListController.m +++ b/Source/SPProcessListController.m @@ -487,7 +487,7 @@ [processListTableView reloadData]; - [processesCountTextField setStringValue:[NSString stringWithFormat:NSLocalizedString(@"%d of %d", "filtered server processes count"), [processesFiltered count], [processes count]]]; + [processesCountTextField setStringValue:[NSString stringWithFormat:NSLocalizedString(@"%d of %d", "filtered item count"), [processesFiltered count], [processes count]]]; [processesCountTextField setHidden:NO]; if ([processesFiltered count] == 0) return; diff --git a/Source/SPQueryController.h b/Source/SPQueryController.h index 79d1ea8c..2a7af9ca 100644 --- a/Source/SPQueryController.h +++ b/Source/SPQueryController.h @@ -33,8 +33,7 @@ IBOutlet NSSearchField *consoleSearchField; IBOutlet NSTextField *loggingDisabledTextField; IBOutlet NSProgressIndicator *progressIndicator; - IBOutlet NSButton *includeTimeStampsButton, *saveConsoleButton, *clearConsoleButton; - IBOutlet NSMenuItem *showTimeStampsMenuItem, *showSelectShowStatementsMenuItem, *showHelpMenuItem; + IBOutlet NSButton *includeTimeStampsButton, *includeConnectionButton, *saveConsoleButton, *clearConsoleButton; NSFont *consoleFont; NSMutableArray *messagesFullSet, *messagesFilteredSet, *messagesVisibleSet; @@ -53,6 +52,7 @@ NSUInteger numberOfMaxAllowedHistory; NSUserDefaults *prefs; + NSDateFormatter *dateFormatter; } @property (readwrite, retain) NSFont *consoleFont; @@ -64,16 +64,17 @@ - (IBAction)clearConsole:(id)sender; - (IBAction)saveConsoleAs:(id)sender; - (IBAction)toggleShowTimeStamps:(id)sender; +- (IBAction)toggleShowConnections:(id)sender; - (IBAction)toggleShowSelectShowStatements:(id)sender; - (IBAction)toggleShowHelpStatements:(id)sender; - (void)updateEntries; -- (BOOL) allowConsoleUpdate; -- (void) setAllowConsoleUpdate:(BOOL)allowUpdate; +- (BOOL)allowConsoleUpdate; +- (void)setAllowConsoleUpdate:(BOOL)allowUpdate; -- (void)showMessageInConsole:(NSString *)message; -- (void)showErrorInConsole:(NSString *)error; +- (void)showMessageInConsole:(NSString *)message connection:(NSString *)connection; +- (void)showErrorInConsole:(NSString *)error connection:(NSString *)connection; - (NSUInteger)consoleMessageCount; diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m index eeca9323..f951e582 100644 --- a/Source/SPQueryController.m +++ b/Source/SPQueryController.m @@ -32,20 +32,19 @@ #define MESSAGE_TIME_STAMP_FORMAT @"%H:%M:%S" #define DEFAULT_CONSOLE_LOG_FILENAME @"untitled" - #define CONSOLE_WINDOW_AUTO_SAVE_NAME @"QueryConsole" // Table view column identifiers -#define TABLEVIEW_MESSAGE_COLUMN_IDENTIFIER @"message" -#define TABLEVIEW_DATE_COLUMN_IDENTIFIER @"messageDate" +#define TABLEVIEW_MESSAGE_COLUMN_IDENTIFIER @"message" +#define TABLEVIEW_DATE_COLUMN_IDENTIFIER @"messageDate" +#define TABLEVIEW_CONNECTION_COLUMN_IDENTIFIER @"messageConnection" @interface SPQueryController (PrivateAPI) -- (NSString *)_getConsoleStringWithTimeStamps:(BOOL)timeStamps; - - (void)_updateFilterState; -- (void)_addMessageToConsole:(NSString *)message isError:(BOOL)error; - (BOOL)_messageMatchesCurrentFilters:(NSString *)message; +- (NSString *)_getConsoleStringWithTimeStamps:(BOOL)timeStamps connections:(BOOL)connections; +- (void)_addMessageToConsole:(NSString *)message connection:(NSString *)connection isError:(BOOL)error; @end @@ -131,37 +130,34 @@ static SPQueryController *sharedQueryController = nil; prefs = [NSUserDefaults standardUserDefaults]; [self setWindowFrameAutosaveName:CONSOLE_WINDOW_AUTO_SAVE_NAME]; + + // Show/hide table columns [[consoleTableView tableColumnWithIdentifier:TABLEVIEW_DATE_COLUMN_IDENTIFIER] setHidden:![prefs boolForKey:SPConsoleShowTimestamps]]; + [[consoleTableView tableColumnWithIdentifier:TABLEVIEW_CONNECTION_COLUMN_IDENTIFIER] setHidden:![prefs boolForKey:SPConsoleShowConnections]]; + showSelectStatementsAreDisabled = ![prefs boolForKey:SPConsoleShowSelectsAndShows]; showHelpStatementsAreDisabled = ![prefs boolForKey:SPConsoleShowHelps]; [self _updateFilterState]; - [loggingDisabledTextField setStringValue:([prefs boolForKey:SPConsoleEnableLogging]) ? @"" : @"Query logging is currently disabled"]; -} - -/** - * Standard dealloc. - */ -- (void)dealloc -{ - messagesVisibleSet = nil; - - [messagesFullSet release], messagesFullSet = nil; - [messagesFilteredSet release], messagesFilteredSet = nil; - [activeFilterString release], activeFilterString = nil; + [loggingDisabledTextField setStringValue:([prefs boolForKey:SPConsoleEnableLogging]) ? @"" : NSLocalizedString(@"Query logging is currently disabled", @"query logging disabled label")]; + + // Setup data formatter + dateFormatter = [[NSDateFormatter alloc] init]; + + [dateFormatter setFormatterBehavior:NSDateFormatterBehavior10_4]; + + [dateFormatter setDateStyle:NSDateFormatterNoStyle]; + [dateFormatter setTimeStyle:NSDateFormatterMediumStyle]; - [favoritesContainer release]; - [historyContainer release]; - [contentFilterContainer release]; + // Set the process table view's vertical gridlines if required + [consoleTableView setGridStyleMask:([prefs boolForKey:SPDisplayTableViewVerticalGridlines]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone]; - [super dealloc]; } #pragma mark - #pragma mark QueryConsoleController - /** * Copy implementation for console table view. */ @@ -177,6 +173,7 @@ static SPQueryController *sharedQueryController = nil; NSUInteger i = [rows firstIndex]; BOOL dateColumnIsHidden = [[consoleTableView tableColumnWithIdentifier:TABLEVIEW_DATE_COLUMN_IDENTIFIER] isHidden]; + BOOL connectionColumnIsHidden = [[consoleTableView tableColumnWithIdentifier:TABLEVIEW_CONNECTION_COLUMN_IDENTIFIER] isHidden]; [string setString:@""]; @@ -184,18 +181,21 @@ static SPQueryController *sharedQueryController = nil; { if (i < [messagesVisibleSet count]) { SPConsoleMessage *message = NSArrayObjectAtIndex(messagesVisibleSet, i); - - NSString *consoleMessage = [message message]; - + // If the timestamp column is not hidden we need to include them in the copy if (!dateColumnIsHidden) { - - NSString *dateString = [[message messageDate] descriptionWithCalendarFormat:MESSAGE_TIME_STAMP_FORMAT timeZone:nil locale:nil]; - - consoleMessage = [NSString stringWithFormat:@"/* MySQL %@ */ %@", dateString, consoleMessage]; + [string appendString:[dateFormatter stringFromDate:[message messageDate]]]; + [string appendString:@" "]; } - [string appendFormat:@"%@\n", consoleMessage]; + // If the connection column is not hidden we need to include them in the copy + if (!connectionColumnIsHidden) { + [string appendString:[message messageConnection]]; + [string appendString:@" "]; + } + + [string appendString:[message message]]; + [string appendString:@"\n"]; } i = [rows indexGreaterThanIndex:i]; @@ -247,6 +247,14 @@ static SPQueryController *sharedQueryController = nil; } /** + * Toggles the display of message connections column in the table view. + */ +- (IBAction)toggleShowConnections:(id)sender +{ + [[consoleTableView tableColumnWithIdentifier:TABLEVIEW_CONNECTION_COLUMN_IDENTIFIER] setHidden:([sender state])]; +} + +/** * Toggles the hiding of messages containing SELECT and SHOW statements */ - (IBAction)toggleShowSelectShowStatements:(id)sender @@ -269,19 +277,19 @@ static SPQueryController *sharedQueryController = nil; } /** - * Shows the supplied message in the console. + * Shows the supplied message from the supplied connection in the console. */ -- (void)showMessageInConsole:(NSString *)message +- (void)showMessageInConsole:(NSString *)message connection:(NSString *)connection { - [self _addMessageToConsole:message isError:NO]; + [self _addMessageToConsole:message connection:connection isError:NO]; } /** - * Shows the supplied error in the console. + * Shows the supplied error from the supplied connection in the console. */ -- (void)showErrorInConsole:(NSString *)error +- (void)showErrorInConsole:(NSString *)error connection:(NSString *)connection { - [self _addMessageToConsole:error isError:YES]; + [self _addMessageToConsole:error connection:connection isError:YES]; } /** @@ -298,7 +306,7 @@ static SPQueryController *sharedQueryController = nil; - (void)savePanelDidEnd:(NSSavePanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { if (returnCode == NSOKButton) { - [[self _getConsoleStringWithTimeStamps:[includeTimeStampsButton intValue]] writeToFile:[sheet filename] atomically:YES encoding:NSUTF8StringEncoding error:NULL]; + [[self _getConsoleStringWithTimeStamps:[includeTimeStampsButton intValue] connections:[includeConnectionButton intValue]] writeToFile:[sheet filename] atomically:YES encoding:NSUTF8StringEncoding error:NULL]; } } @@ -324,9 +332,11 @@ static SPQueryController *sharedQueryController = nil; if ([[tableColumn identifier] isEqualToString:TABLEVIEW_DATE_COLUMN_IDENTIFIER]) { - NSString *dateString = [(NSDate *)object descriptionWithCalendarFormat:MESSAGE_TIME_STAMP_FORMAT timeZone:nil locale:nil]; + //NSString *dateString = [(NSDate *)object descriptionWithCalendarFormat:MESSAGE_TIME_STAMP_FORMAT timeZone:nil locale:nil]; + + returnValue = [dateFormatter stringFromDate:(NSDate *)object]; - returnValue = [NSString stringWithFormat:@"/* MySQL %@ */", dateString]; + //returnValue = dateString; } else { if ([(NSString *)object length] > MESSAGE_TRUNCATE_CHARACTER_LENGTH) { @@ -381,9 +391,14 @@ static SPQueryController *sharedQueryController = nil; */ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { + // Show/hide logging disabled label if ([keyPath isEqualToString:SPConsoleEnableLogging]) { [loggingDisabledTextField setStringValue:([[change objectForKey:NSKeyValueChangeNewKey] boolValue]) ? @"" : @"Query logging is currently disabled"]; } + // Show/hide vertical grid lines in console table view + else if ([keyPath isEqualToString:SPDisplayTableViewVerticalGridlines]) { + [consoleTableView setGridStyleMask:([[change objectForKey:NSKeyValueChangeNewKey] boolValue]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone]; + } } /** @@ -403,10 +418,13 @@ static SPQueryController *sharedQueryController = nil; return [[self window] validateMenuItem:menuItem]; } -- (BOOL) allowConsoleUpdate { +- (BOOL) allowConsoleUpdate +{ return allowConsoleUpdate; } -- (void) setAllowConsoleUpdate:(BOOL)allowUpdate { + +- (void) setAllowConsoleUpdate:(BOOL)allowUpdate +{ allowConsoleUpdate = allowUpdate; if (allowUpdate && [[self window] isVisible]) [self updateEntries]; } @@ -427,7 +445,6 @@ static SPQueryController *sharedQueryController = nil; - (NSURL *)registerDocumentWithFileURL:(NSURL *)fileURL andContextInfo:(NSMutableDictionary *)contextInfo { - // Register a new untiled document and return its URL if(fileURL == nil) { NSURL *new = [NSURL URLWithString:[[NSString stringWithFormat:@"Untitled %d", untitledDocumentCounter] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; @@ -476,6 +493,7 @@ static SPQueryController *sharedQueryController = nil; [arr release]; } } + if(![historyContainer objectForKey:[fileURL absoluteString]]) { if(contextInfo != nil && [contextInfo objectForKey:SPQueryHistory] && [[contextInfo objectForKey:SPQueryHistory] count]) { NSMutableArray *arr = [[NSMutableArray alloc] init]; @@ -488,6 +506,7 @@ static SPQueryController *sharedQueryController = nil; [arr release]; } } + if(![contentFilterContainer objectForKey:[fileURL absoluteString]]) { if(contextInfo != nil && [contextInfo objectForKey:SPContentFilters]) { [contentFilterContainer setObject:[contextInfo objectForKey:SPContentFilters] forKey:[fileURL absoluteString]]; @@ -499,12 +518,10 @@ static SPQueryController *sharedQueryController = nil; } return fileURL; - } - (void)removeRegisteredDocumentWithFileURL:(NSURL *)fileURL { - // Check for multiple instance of the same document. // Remove it if only one instance was registerd. NSArray *allDocs = [[NSDocumentController sharedDocumentController] documents]; @@ -523,12 +540,10 @@ static SPQueryController *sharedQueryController = nil; [historyContainer removeObjectForKey:[fileURL absoluteString]]; if([contentFilterContainer objectForKey:[fileURL absoluteString]]) [contentFilterContainer removeObjectForKey:[fileURL absoluteString]]; - } - (void)replaceContentFilterByArray:(NSArray *)contentFilterArray ofType:(NSString *)filterType forFileURL:(NSURL *)fileURL { - if([contentFilterContainer objectForKey:[fileURL absoluteString]]) { NSMutableDictionary *c = [[NSMutableDictionary alloc] init]; [c setDictionary:[contentFilterContainer objectForKey:[fileURL absoluteString]]]; @@ -536,7 +551,6 @@ static SPQueryController *sharedQueryController = nil; [contentFilterContainer setObject:c forKey:[fileURL absoluteString]]; [c release]; } - } - (void)replaceFavoritesByArray:(NSArray *)favoritesArray forFileURL:(NSURL *)fileURL @@ -559,7 +573,6 @@ static SPQueryController *sharedQueryController = nil; - (void)addHistory:(NSString *)history forFileURL:(NSURL *)fileURL { - NSUInteger maxHistoryItems = [[prefs objectForKey:SPCustomQueryMaxHistoryItems] intValue]; // Save each history item due to its document source @@ -575,7 +588,6 @@ static SPQueryController *sharedQueryController = nil; [self replaceHistoryByArray:[uniquifier itemTitles] forFileURL:fileURL]; [uniquifier release]; - } // Save history items coming from each Untitled document in the global Preferences successively @@ -592,9 +604,7 @@ static SPQueryController *sharedQueryController = nil; [prefs setObject:[uniquifier itemTitles] forKey:SPQueryHistory]; [uniquifier release]; - } - } - (NSMutableArray *)favoritesForFileURL:(NSURL *)fileURL @@ -603,7 +613,6 @@ static SPQueryController *sharedQueryController = nil; return [favoritesContainer objectForKey:[fileURL absoluteString]]; return [NSMutableArray array]; - } - (NSMutableArray *)historyForFileURL:(NSURL *)fileURL @@ -612,7 +621,6 @@ static SPQueryController *sharedQueryController = nil; return [historyContainer objectForKey:[fileURL absoluteString]]; return [NSMutableArray array]; - } - (NSMutableDictionary *)contentFilterForFileURL:(NSURL *)fileURL @@ -621,12 +629,10 @@ static SPQueryController *sharedQueryController = nil; return [contentFilterContainer objectForKey:[fileURL absoluteString]]; return [NSMutableDictionary dictionary]; - } - (NSArray *)queryFavoritesForFileURL:(NSURL *)fileURL andTabTrigger:(NSString *)tabTrigger includeGlobals:(BOOL)includeGlobals { - if(![tabTrigger length]) return [NSArray array]; NSMutableArray *result = [[NSMutableArray alloc] init]; @@ -655,33 +661,31 @@ static SPQueryController *sharedQueryController = nil; [[favoritesContainer objectForKey:[fileURL absoluteString]] insertObject:favorite atIndex:index]; } - -@end - -@implementation SPQueryController (PrivateAPI) +#pragma mark - /** - * Creates and returns a string made entirely of all of the console's messages and includes the message - * time stamps if specified. + * Dealloc. */ -- (NSString *)_getConsoleStringWithTimeStamps:(BOOL)timeStamps +- (void)dealloc { - NSMutableString *consoleString = [[[NSMutableString alloc] init] autorelease]; + messagesVisibleSet = nil; - for (SPConsoleMessage *message in messagesVisibleSet) - { - if (timeStamps) { - NSString *dateString = [[message messageDate] descriptionWithCalendarFormat:MESSAGE_TIME_STAMP_FORMAT timeZone:nil locale:nil]; - - [consoleString appendString:[NSString stringWithFormat:@"/* MySQL %@ */ ", dateString]]; - } - - [consoleString appendString:[NSString stringWithFormat:@"%@\n", [message message]]]; - } + [dateFormatter release], dateFormatter = nil; - return consoleString; + [messagesFullSet release], messagesFullSet = nil; + [messagesFilteredSet release], messagesFilteredSet = nil; + [activeFilterString release], activeFilterString = nil; + + [favoritesContainer release], favoritesContainer = nil; + [historyContainer release], historyContainer = nil; + [contentFilterContainer release], contentFilterContainer = nil; + + [super dealloc]; } +@end + +@implementation SPQueryController (PrivateAPI) /** * Updates the filtered result set based on any filter string and whether or not @@ -752,33 +756,6 @@ static SPQueryController *sharedQueryController = nil; } /** - * Adds the supplied message to the query console. - */ -- (void)_addMessageToConsole:(NSString *)message isError:(BOOL)error -{ - SPConsoleMessage *consoleMessage = [SPConsoleMessage consoleMessageWithMessage:[[[message stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] stringByReplacingOccurrencesOfString:@"\n" withString:@" "] stringByAppendingString:@";"] date:[NSDate date]]; - - [consoleMessage setIsError:error]; - - [messagesFullSet addObject:consoleMessage]; - - // If filtering is active, determine whether to add a reference to the filtered set - if ((showSelectStatementsAreDisabled || showHelpStatementsAreDisabled || filterIsActive) - && [self _messageMatchesCurrentFilters:[consoleMessage message]]) - { - [messagesFilteredSet addObject:[messagesFullSet lastObject]]; - [saveConsoleButton setEnabled:YES]; - [clearConsoleButton setEnabled:YES]; - } - - // Reload the table and scroll to the new message if it's visible (for speed) - if ( allowConsoleUpdate && [[self window] isVisible] ) { - [consoleTableView reloadData]; - [consoleTableView scrollRowToVisible:([messagesVisibleSet count] - 1)]; - } -} - -/** * Checks whether the supplied message text matches the current filter text, if any, * and whether it should be hidden if the SELECT/SHOW toggle is off. */ @@ -800,6 +777,7 @@ static SPQueryController *sharedQueryController = nil; { messageMatchesCurrentFilters = NO; } + // If hiding HELP is toggled to on, check whether the message is a HELP if (messageMatchesCurrentFilters && showHelpStatementsAreDisabled @@ -811,4 +789,67 @@ static SPQueryController *sharedQueryController = nil; return messageMatchesCurrentFilters; } +/** + * Creates and returns a string made entirely of all of the console's messages and includes the message + * time stamp and connection if specified. + */ +- (NSString *)_getConsoleStringWithTimeStamps:(BOOL)timeStamps connections:(BOOL)connections +{ + NSMutableString *consoleString = [NSMutableString string]; + + for (SPConsoleMessage *message in messagesVisibleSet) + { + // As we are going to save the messages as an SQL file we need to comment + // the timestamps and connections if included. + if (timeStamps || connections) [consoleString appendString:@"/* "]; + + // If the timestamp column is not hidden we need to include them in the copy + if (timeStamps) { + [consoleString appendString:[dateFormatter stringFromDate:[message messageDate]]]; + [consoleString appendString:@" "]; + } + + // If the connection column is not hidden we need to include them in the copy + if (connections) { + [consoleString appendString:[message messageConnection]]; + [consoleString appendString:@" "]; + } + + // Close the comment + if (timeStamps || connections) [consoleString appendString:@"*/ "]; + + [consoleString appendString:[message message]]; + [consoleString appendString:@"\n"]; + } + + return consoleString; +} + +/** + * Adds the supplied message to the query console. + */ +- (void)_addMessageToConsole:(NSString *)message connection:(NSString *)connection isError:(BOOL)error +{ + SPConsoleMessage *consoleMessage = [SPConsoleMessage consoleMessageWithMessage:[[[message stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] stringByReplacingOccurrencesOfString:@"\n" withString:@" "] stringByAppendingString:@";"] date:[NSDate date] connection:connection]; + + [consoleMessage setIsError:error]; + + [messagesFullSet addObject:consoleMessage]; + + // If filtering is active, determine whether to add a reference to the filtered set + if ((showSelectStatementsAreDisabled || showHelpStatementsAreDisabled || filterIsActive) + && [self _messageMatchesCurrentFilters:[consoleMessage message]]) + { + [messagesFilteredSet addObject:[messagesFullSet lastObject]]; + [saveConsoleButton setEnabled:YES]; + [clearConsoleButton setEnabled:YES]; + } + + // Reload the table and scroll to the new message if it's visible (for speed) + if (allowConsoleUpdate && [[self window] isVisible]) { + [consoleTableView reloadData]; + [consoleTableView scrollRowToVisible:([messagesVisibleSet count] - 1)]; + } +} + @end diff --git a/Source/SPServerVariablesController.m b/Source/SPServerVariablesController.m index ca4f53b1..17bb5ba0 100644 --- a/Source/SPServerVariablesController.m +++ b/Source/SPServerVariablesController.m @@ -317,7 +317,7 @@ [variablesTableView reloadData]; [variablesCountTextField setHidden:NO]; - [variablesCountTextField setStringValue:[NSString stringWithFormat:NSLocalizedString(@"%d of %d", "filtered server variables count"), [variablesFiltered count], [variables count]]]; + [variablesCountTextField setStringValue:[NSString stringWithFormat:NSLocalizedString(@"%d of %d", "filtered item count"), [variablesFiltered count], [variables count]]]; if ([variablesFiltered count] == 0) return; diff --git a/Source/TableContent.m b/Source/TableContent.m index 6d1c4a54..d479a3a3 100644 --- a/Source/TableContent.m +++ b/Source/TableContent.m @@ -1628,7 +1628,7 @@ isEditingRow = NO; isEditingNewRow = NO; currentlyEditingRow = -1; - [[SPQueryController sharedQueryController] showErrorInConsole:[NSString stringWithFormat:NSLocalizedString(@"/* WARNING %@ No rows have been affected */\n", @"warning shown in the console when no rows have been affected after writing to the db"), currentTime]]; + [[SPQueryController sharedQueryController] showErrorInConsole:[NSString stringWithFormat:NSLocalizedString(@"/* WARNING %@ No rows have been affected */\n", @"warning shown in the console when no rows have been affected after writing to the db"), currentTime] connection:[tableDocumentInstance name]]; return YES; // On success... diff --git a/Source/TableDocument.h b/Source/TableDocument.h index 2aae4da5..f9e96730 100644 --- a/Source/TableDocument.h +++ b/Source/TableDocument.h @@ -231,7 +231,7 @@ - (IBAction)backForwardInHistory:(id)sender; - (IBAction)showUserManager:(id)sender; -// Getter methods +// Accessor methods - (NSString *)host; - (NSString *)name; - (NSString *)database; diff --git a/Source/TableDocument.m b/Source/TableDocument.m index 8d1bca5f..df856d33 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -172,6 +172,7 @@ [prefs addObserver:tableContentInstance forKeyPath:SPDisplayTableViewVerticalGridlines options:NSKeyValueObservingOptionNew context:NULL]; [prefs addObserver:customQueryInstance forKeyPath:SPDisplayTableViewVerticalGridlines options:NSKeyValueObservingOptionNew context:NULL]; [prefs addObserver:tableRelationsInstance forKeyPath:SPDisplayTableViewVerticalGridlines options:NSKeyValueObservingOptionNew context:NULL]; + [prefs addObserver:[SPQueryController sharedQueryController] forKeyPath:SPDisplayTableViewVerticalGridlines options:NSKeyValueObservingOptionNew context:NULL]; // Register observers for when the logging preference changes [prefs addObserver:[SPQueryController sharedQueryController] forKeyPath:SPConsoleEnableLogging options:NSKeyValueObservingOptionNew context:NULL]; @@ -2142,7 +2143,7 @@ } #pragma mark - -#pragma mark Getter methods +#pragma mark Accessor methods /** * Returns the host |