diff options
-rw-r--r-- | Interfaces/English.lproj/Preferences.xib | 111 | ||||
-rw-r--r-- | Source/CMCopyTable.m | 4 | ||||
-rw-r--r-- | Source/CMMCPConnection.h | 6 | ||||
-rw-r--r-- | Source/CMMCPConnection.m | 26 | ||||
-rw-r--r-- | Source/CMMCPResult.m | 3 | ||||
-rw-r--r-- | Source/CMTextView.m | 11 | ||||
-rw-r--r-- | Source/CustomQuery.m | 21 | ||||
-rw-r--r-- | Source/NoodleLineNumberView.m | 7 | ||||
-rw-r--r-- | Source/SPArrayAdditions.h | 9 | ||||
-rw-r--r-- | Source/SPExportController.m | 7 | ||||
-rw-r--r-- | Source/SPNarrowDownCompletion.m | 5 | ||||
-rw-r--r-- | Source/SPQueryConsole.m | 3 | ||||
-rw-r--r-- | Source/SPTableData.m | 54 | ||||
-rw-r--r-- | Source/TableContent.m | 42 | ||||
-rw-r--r-- | Source/TableDocument.m | 5 | ||||
-rw-r--r-- | Source/TableDump.m | 69 | ||||
-rw-r--r-- | Source/TablesList.m | 17 | ||||
-rw-r--r-- | sequel-pro.xcodeproj/project.pbxproj | 2 |
18 files changed, 187 insertions, 215 deletions
diff --git a/Interfaces/English.lproj/Preferences.xib b/Interfaces/English.lproj/Preferences.xib index 1f40515d..3dcce06a 100644 --- a/Interfaces/English.lproj/Preferences.xib +++ b/Interfaces/English.lproj/Preferences.xib @@ -8,7 +8,7 @@ <string key="IBDocument.HIToolboxVersion">353.00</string> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="56"/> + <integer value="512"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -53,7 +53,7 @@ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> </object> <object class="NSCustomView" id="594324362"> - <reference key="NSNextResponder"/> + <nil key="NSNextResponder"/> <int key="NSvFlags">268</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -62,7 +62,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{151, 121}, {254, 26}}</string> <reference key="NSSuperview" ref="594324362"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSPopUpButtonCell" key="NSCell" id="562129977"> <int key="NSCellFlags">-2076049856</int> @@ -390,7 +389,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{152, 168}, {209, 18}}</string> <reference key="NSSuperview" ref="594324362"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="964808674"> <int key="NSCellFlags">67239424</int> @@ -418,7 +416,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{40, 196}, {108, 17}}</string> <reference key="NSSuperview" ref="594324362"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="996600667"> <int key="NSCellFlags">67239488</int> @@ -451,7 +448,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{151, 190}, {254, 26}}</string> <reference key="NSSuperview" ref="594324362"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSPopUpButtonCell" key="NSCell" id="406329678"> <int key="NSCellFlags">-2076049856</int> @@ -484,7 +480,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{33, 127}, {116, 17}}</string> <reference key="NSSuperview" ref="594324362"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="163779676"> <int key="NSCellFlags">67239424</int> @@ -501,7 +496,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{152, 84}, {166, 18}}</string> <reference key="NSSuperview" ref="594324362"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="530413242"> <int key="NSCellFlags">67239424</int> @@ -524,7 +518,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{152, 62}, {254, 18}}</string> <reference key="NSSuperview" ref="594324362"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="218042555"> <int key="NSCellFlags">67239424</int> @@ -547,7 +540,6 @@ <int key="NSvFlags">12</int> <string key="NSFrame">{{154, 156}, {326, 5}}</string> <reference key="NSSuperview" ref="594324362"/> - <reference key="NSWindow"/> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> <int key="NSCellFlags">67239424</int> @@ -578,7 +570,6 @@ <int key="NSvFlags">12</int> <string key="NSFrame">{{154, 108}, {326, 5}}</string> <reference key="NSSuperview" ref="594324362"/> - <reference key="NSWindow"/> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> <int key="NSCellFlags">67239424</int> @@ -601,7 +592,6 @@ <int key="NSvFlags">12</int> <string key="NSFrame">{{154, 53}, {326, 5}}</string> <reference key="NSSuperview" ref="594324362"/> - <reference key="NSWindow"/> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> <int key="NSCellFlags">67239424</int> @@ -624,7 +614,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{38, 23}, {110, 17}}</string> <reference key="NSSuperview" ref="594324362"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="899935643"> <int key="NSCellFlags">68288064</int> @@ -641,7 +630,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{153, 20}, {38, 22}}</string> <reference key="NSSuperview" ref="594324362"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="875775803"> <int key="NSCellFlags">-1804468671</int> @@ -698,8 +686,8 @@ <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> @@ -720,7 +708,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{197, 23}, {162, 17}}</string> <reference key="NSSuperview" ref="594324362"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="710086132"> <int key="NSCellFlags">68288064</int> @@ -734,8 +721,6 @@ </object> </object> <string key="NSFrameSize">{500, 234}</string> - <reference key="NSSuperview"/> - <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> <object class="NSCustomView" id="395894064"> @@ -748,7 +733,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{152, 181}, {123, 18}}</string> <reference key="NSSuperview" ref="395894064"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="7693853"> <int key="NSCellFlags">67239424</int> @@ -771,7 +755,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{28, 220}, {120, 17}}</string> <reference key="NSSuperview" ref="395894064"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="524603578"> <int key="NSCellFlags">67239488</int> @@ -788,7 +771,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{374, 67}, {38, 17}}</string> <reference key="NSSuperview" ref="395894064"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="596167553"> <int key="NSCellFlags">67239488</int> @@ -805,7 +787,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{152, 221}, {106, 18}}</string> <reference key="NSSuperview" ref="395894064"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="29938940"> <int key="NSCellFlags">-2080244224</int> @@ -828,7 +809,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{152, 66}, {115, 18}}</string> <reference key="NSSuperview" ref="395894064"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="920748663"> <int key="NSCellFlags">67239424</int> @@ -851,7 +831,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{152, 201}, {105, 18}}</string> <reference key="NSSuperview" ref="395894064"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="516443326"> <int key="NSCellFlags">-2080244224</int> @@ -874,7 +853,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{353, 61}, {19, 27}}</string> <reference key="NSSuperview" ref="395894064"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSStepperCell" key="NSCell" id="1061407286"> <int key="NSCellFlags">917024</int> @@ -882,7 +860,7 @@ <reference key="NSControlView" ref="813674245"/> <double key="NSValue">1.000000e+02</double> <double key="NSMinValue">1.000000e+00</double> - <double key="NSMaxValue">1.000000e+03</double> + <double key="NSMaxValue">5.000000e+04</double> <double key="NSIncrement">1.000000e+00</double> <bool key="NSValueWraps">YES</bool> <bool key="NSAutorepeat">YES</bool> @@ -893,7 +871,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{273, 64}, {75, 22}}</string> <reference key="NSSuperview" ref="395894064"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="585678618"> <int key="NSCellFlags">-1804468672</int> @@ -944,8 +921,8 @@ <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> @@ -962,7 +939,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{17, 22}, {131, 17}}</string> <reference key="NSSuperview" ref="395894064"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="609090823"> <int key="NSCellFlags">68288064</int> @@ -979,7 +955,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{154, 20}, {75, 22}}</string> <reference key="NSSuperview" ref="395894064"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="82744709"> <int key="NSCellFlags">-1804468671</int> @@ -998,7 +973,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{152, 141}, {297, 18}}</string> <reference key="NSSuperview" ref="395894064"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="441275"> <int key="NSCellFlags">67239424</int> @@ -1021,7 +995,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{152, 121}, {225, 18}}</string> <reference key="NSSuperview" ref="395894064"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="561991963"> <int key="NSCellFlags">67239424</int> @@ -1044,7 +1017,6 @@ <int key="NSvFlags">12</int> <string key="NSFrame">{{154, 167}, {326, 5}}</string> <reference key="NSSuperview" ref="395894064"/> - <reference key="NSWindow"/> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> <int key="NSCellFlags">67239424</int> @@ -1067,7 +1039,6 @@ <int key="NSvFlags">12</int> <string key="NSFrame">{{154, 92}, {326, 5}}</string> <reference key="NSSuperview" ref="395894064"/> - <reference key="NSWindow"/> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> <int key="NSCellFlags">67239424</int> @@ -1090,7 +1061,6 @@ <int key="NSvFlags">12</int> <string key="NSFrame">{{154, 53}, {326, 5}}</string> <reference key="NSSuperview" ref="395894064"/> - <reference key="NSWindow"/> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> <int key="NSCellFlags">67239424</int> @@ -1113,7 +1083,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{152, 101}, {206, 18}}</string> <reference key="NSSuperview" ref="395894064"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="542131730"> <int key="NSCellFlags">-2080244224</int> @@ -1134,7 +1103,6 @@ </object> <string key="NSFrameSize">{500, 259}</string> <reference key="NSSuperview"/> - <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> <object class="NSCustomView" id="593732956"> @@ -1320,6 +1288,7 @@ </object> <string key="NSFrame">{{1, 1}, {198, 358}}</string> <reference key="NSSuperview" ref="533802223"/> + <reference key="NSNextKeyView" ref="279932544"/> <reference key="NSDocView" ref="279932544"/> <reference key="NSBGColor" ref="887465699"/> <int key="NScvFlags">4</int> @@ -1347,6 +1316,7 @@ </object> <string key="NSFrame">{{-2, 22}, {200, 360}}</string> <reference key="NSSuperview" ref="984943037"/> + <reference key="NSNextKeyView" ref="253139122"/> <int key="NSsFlags">530</int> <reference key="NSVScroller" ref="940130901"/> <reference key="NSHScroller" ref="2545381"/> @@ -1810,6 +1780,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{152, 173}, {187, 18}}</string> <reference key="NSSuperview" ref="1041614321"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="1060471631"> <int key="NSCellFlags">67239424</int> @@ -1832,6 +1803,7 @@ <int key="NSvFlags">12</int> <string key="NSFrame">{{154, 136}, {334, 5}}</string> <reference key="NSSuperview" ref="1041614321"/> + <reference key="NSWindow"/> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> <int key="NSCellFlags">67239424</int> @@ -1854,6 +1826,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{152, 150}, {261, 18}}</string> <reference key="NSSuperview" ref="1041614321"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="695439962"> <int key="NSCellFlags">67239424</int> @@ -1876,6 +1849,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{152, 110}, {142, 18}}</string> <reference key="NSSuperview" ref="1041614321"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="641765383"> <int key="NSCellFlags">67239424</int> @@ -1898,6 +1872,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{180, 87}, {77, 18}}</string> <reference key="NSSuperview" ref="1041614321"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="135236421"> <int key="NSCellFlags">67239424</int> @@ -1920,6 +1895,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{180, 64}, {123, 18}}</string> <reference key="NSSuperview" ref="1041614321"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="510254021"> <int key="NSCellFlags">67239424</int> @@ -1942,6 +1918,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{180, 41}, {154, 18}}</string> <reference key="NSSuperview" ref="1041614321"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="29352039"> <int key="NSCellFlags">67239424</int> @@ -1964,6 +1941,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{180, 18}, {63, 18}}</string> <reference key="NSSuperview" ref="1041614321"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="545580787"> <int key="NSCellFlags">67239424</int> @@ -1984,6 +1962,7 @@ </object> <string key="NSFrameSize">{500, 209}</string> <reference key="NSSuperview"/> + <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> <object class="NSCustomView" id="369742224"> @@ -2225,8 +2204,8 @@ AQAAAAA</bytes> <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">YES</bool> @@ -2281,7 +2260,7 @@ AQAAAAA</bytes> <string key="NSClassName">NSView</string> </object> <object class="NSCustomView" id="1033452264"> - <reference key="NSNextResponder"/> + <nil key="NSNextResponder"/> <int key="NSvFlags">268</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -2297,7 +2276,6 @@ AQAAAAA</bytes> </object> <string key="NSFrame">{{154, 199}, {44, 23}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <bool key="NSIsBordered">YES</bool> <object class="NSColor" key="NSColor"> @@ -2317,7 +2295,6 @@ AQAAAAA</bytes> </object> <string key="NSFrame">{{154, 228}, {44, 23}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <bool key="NSIsBordered">YES</bool> <object class="NSColor" key="NSColor"> @@ -2337,7 +2314,6 @@ AQAAAAA</bytes> </object> <string key="NSFrame">{{154, 141}, {44, 23}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <bool key="NSIsBordered">YES</bool> <object class="NSColor" key="NSColor"> @@ -2357,7 +2333,6 @@ AQAAAAA</bytes> </object> <string key="NSFrame">{{154, 112}, {44, 23}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <bool key="NSIsBordered">YES</bool> <object class="NSColor" key="NSColor"> @@ -2377,7 +2352,6 @@ AQAAAAA</bytes> </object> <string key="NSFrame">{{154, 286}, {44, 23}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <bool key="NSIsBordered">YES</bool> <object class="NSColor" key="NSColor"> @@ -2397,7 +2371,6 @@ AQAAAAA</bytes> </object> <string key="NSFrame">{{154, 170}, {44, 23}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <bool key="NSIsBordered">YES</bool> <object class="NSColor" key="NSColor"> @@ -2417,7 +2390,6 @@ AQAAAAA</bytes> </object> <string key="NSFrame">{{154, 83}, {44, 23}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <bool key="NSIsBordered">YES</bool> <object class="NSColor" key="NSColor"> @@ -2437,7 +2409,6 @@ AQAAAAA</bytes> </object> <string key="NSFrame">{{154, 54}, {44, 23}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <bool key="NSIsBordered">YES</bool> <object class="NSColor" key="NSColor"> @@ -2457,7 +2428,6 @@ AQAAAAA</bytes> </object> <string key="NSFrame">{{154, 315}, {44, 23}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <bool key="NSIsBordered">YES</bool> <object class="NSColor" key="NSColor"> @@ -2477,7 +2447,6 @@ AQAAAAA</bytes> </object> <string key="NSFrame">{{154, 257}, {44, 23}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSIsBordered">YES</bool> <object class="NSColor" key="NSColor"> <int key="NSColorSpace">1</int> @@ -2489,7 +2458,6 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{86, 202}, {63, 17}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="465390474"> <int key="NSCellFlags">68288064</int> @@ -2506,7 +2474,6 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{88, 173}, {61, 17}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="629129203"> <int key="NSCellFlags">68288064</int> @@ -2523,7 +2490,6 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{79, 231}, {70, 17}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="841770398"> <int key="NSCellFlags">68288064</int> @@ -2540,7 +2506,6 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{89, 86}, {60, 17}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="837982163"> <int key="NSCellFlags">68288064</int> @@ -2557,7 +2522,6 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{23, 58}, {125, 17}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="554509386"> <int key="NSCellFlags">68288064</int> @@ -2574,7 +2538,6 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{102, 144}, {47, 17}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="728610506"> <int key="NSCellFlags">68288064</int> @@ -2591,7 +2554,6 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{112, 318}, {37, 17}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="693342907"> <int key="NSCellFlags">68288064</int> @@ -2608,7 +2570,6 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{46, 115}, {103, 17}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="336899348"> <int key="NSCellFlags">68288064</int> @@ -2625,7 +2586,6 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{66, 289}, {83, 17}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="896659768"> <int key="NSCellFlags">68288064</int> @@ -2642,7 +2602,6 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{113, 357}, {36, 17}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="10706281"> <int key="NSCellFlags">68288064</int> @@ -2659,7 +2618,6 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{73, 12}, {131, 32}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="603963569"> <int key="NSCellFlags">-2080244224</int> @@ -2680,7 +2638,6 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{396, 347}, {90, 32}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="345790946"> <int key="NSCellFlags">67239424</int> @@ -2701,7 +2658,6 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{154, 355}, {240, 19}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="66452133"> <int key="NSCellFlags">-2076049856</int> @@ -2719,7 +2675,6 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{107, 260}, {42, 17}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="632150824"> <int key="NSCellFlags">605158976</int> @@ -2736,7 +2691,6 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{257, 317}, {126, 18}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="823431848"> <int key="NSCellFlags">-2080244224</int> @@ -2759,7 +2713,6 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{257, 288}, {150, 18}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="743257684"> <int key="NSCellFlags">-2080244224</int> @@ -2782,7 +2735,6 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{257, 230}, {179, 18}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="231642073"> <int key="NSCellFlags">67239424</int> @@ -2805,7 +2757,6 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{257, 259}, {185, 18}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="491730308"> <int key="NSCellFlags">-2080244224</int> @@ -2828,7 +2779,6 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{257, 173}, {185, 18}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="496801621"> <int key="NSCellFlags">-2080244224</int> @@ -2851,7 +2801,6 @@ AQAAAAA</bytes> <int key="NSvFlags">-2147483380</int> <string key="NSFrame">{{257, 144}, {197, 18}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="420702000"> <int key="NSCellFlags">-1543373312</int> @@ -2874,7 +2823,6 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{357, 205}, {29, 19}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="992523117"> <int key="NSCellFlags">-1538130368</int> @@ -2950,7 +2898,6 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{298, 207}, {54, 14}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="499174965"> <int key="NSCellFlags">605158976</int> @@ -2967,7 +2914,6 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{392, 203}, {15, 22}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSStepperCell" key="NSCell" id="266600395"> <int key="NSCellFlags">604896800</int> @@ -2986,7 +2932,6 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{410, 207}, {27, 14}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="516695546"> <int key="NSCellFlags">605158976</int> @@ -3003,7 +2948,6 @@ AQAAAAA</bytes> <int key="NSvFlags">12</int> <string key="NSFrame">{{154, 344}, {326, 5}}</string> <reference key="NSSuperview" ref="1033452264"/> - <reference key="NSWindow"/> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> <int key="NSCellFlags">67239424</int> @@ -3023,20 +2967,9 @@ AQAAAAA</bytes> </object> </object> <string key="NSFrameSize">{500, 395}</string> - <reference key="NSSuperview"/> - <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> <object class="NSUserDefaultsController" id="151174232"> - <object class="NSMutableArray" key="NSDeclaredKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>ConsoleEnableLogging</string> - <string>LogInterfaceQueries</string> - <string>EnableInterfaceLogging</string> - <string>EnableImportExportLogging</string> - <string>EnableCustomQueryLogging</string> - <string>EnableErrorLogging</string> - </object> <bool key="NSSharedInstance">YES</bool> </object> <object class="NSArrayController" id="937123943"> @@ -7283,7 +7216,7 @@ AQAAAAA</bytes> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> - <string>{{513, 312}, {500, 259}}</string> + <string>{{406, 312}, {500, 259}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <object class="NSMutableArray"> <bool key="EncodedWithXMLCoder">YES</bool> diff --git a/Source/CMCopyTable.m b/Source/CMCopyTable.m index 2f7bb929..85f8a20e 100644 --- a/Source/CMCopyTable.m +++ b/Source/CMCopyTable.m @@ -101,7 +101,7 @@ int MENU_EDIT_COPY_AS_SQL = 2002; if(withHeaders) { int i; for( i = 0; i < numColumns; i++ ){ - [result appendString:[NSString stringWithFormat:@"%@\t", [[[columns objectAtIndex:i] headerCell] stringValue]]]; + [result appendString:[NSString stringWithFormat:@"%@\t", [[NSArrayObjectAtIndex(columns, i) headerCell] stringValue]]]; } [result appendString:[NSString stringWithFormat:@"\n"]]; } @@ -119,7 +119,7 @@ int MENU_EDIT_COPY_AS_SQL = 2002; rowData = nil; for ( c = 0; c < numColumns; c++) { - col = [columns objectAtIndex:c]; + col = NSArrayObjectAtIndex(columns, c); rowData = [dataSource tableView:self objectValueForTableColumn:col row:[row intValue] ]; diff --git a/Source/CMMCPConnection.h b/Source/CMMCPConnection.h index 4005c19b..81b25535 100644 --- a/Source/CMMCPConnection.h +++ b/Source/CMMCPConnection.h @@ -78,7 +78,13 @@ IMP cStringPtr; IMP willQueryStringPtr; + IMP stopKeepAliveTimerPtr; + IMP startKeepAliveTimerResettingStatePtr; + SEL cStringSEL; + SEL willQueryStringSEL; + SEL stopKeepAliveTimerSEL; + SEL startKeepAliveTimerResettingStateSEL; } - (id) init; diff --git a/Source/CMMCPConnection.m b/Source/CMMCPConnection.m index 4cc2fccf..3101beb9 100644 --- a/Source/CMMCPConnection.m +++ b/Source/CMMCPConnection.m @@ -140,7 +140,14 @@ static void forcePingTimeout(int signalNumber); NSLog(@"Connection error dialog could not be loaded; connection failure handling will not function correctly."); } - cStringPtr = [self methodForSelector:@selector(cStringFromString:usingEncoding:)]; + willQueryStringSEL = @selector(willQueryString:); + stopKeepAliveTimerSEL = @selector(stopKeepAliveTimer); + startKeepAliveTimerResettingStateSEL = @selector(startKeepAliveTimerResettingState:); + cStringSEL = @selector(cStringFromString:); + + cStringPtr = [self methodForSelector:cStringSEL]; + stopKeepAliveTimerPtr = [self methodForSelector:stopKeepAliveTimerSEL]; + startKeepAliveTimerResettingStatePtr = [self methodForSelector:startKeepAliveTimerResettingStateSEL]; } @@ -740,14 +747,14 @@ static void forcePingTimeout(int signalNumber); return nil; } - [self stopKeepAliveTimer]; + (void)(*stopKeepAliveTimerPtr)(self, stopKeepAliveTimerSEL); // queryStartTime = clock(); // Inform the delegate about the query if logging is enabled and // delegate responds to willQueryString: if (consoleLoggingEnabled && delegateResponseToWillQueryString) - (void)(NSString*)(*willQueryStringPtr)(delegate, @selector(willQueryString:), query); + (void)(NSString*)(*willQueryStringPtr)(delegate, willQueryStringSEL, query); // Derive the query string in the correct encoding switch(encoding) { @@ -755,7 +762,7 @@ static void forcePingTimeout(int signalNumber); theCQuery = NSStringUTF8String(query); break; default: - theCQuery = (const char*)(NSString*)(int)(*cStringPtr)(self, @selector(cStringFromString:), query, encoding); + theCQuery = (const char*)(NSString*)(int)(*cStringPtr)(self, cStringSEL, query, encoding); //[self cStringFromString:query usingEncoding:encoding]; } @@ -864,7 +871,7 @@ static void forcePingTimeout(int signalNumber); if (queryResultCode & delegateResponseToWillQueryString) [delegate queryGaveError:lastQueryErrorMessage]; - [self startKeepAliveTimerResettingState:YES]; + (void)(int)(*startKeepAliveTimerResettingStatePtr)(self, startKeepAliveTimerResettingStateSEL, YES); if (!theResult) return nil; return [theResult autorelease]; @@ -950,7 +957,7 @@ static void forcePingTimeout(int signalNumber); if (delegate && [delegate valueForKey:@"_encoding"]) { [self queryString:[NSString stringWithFormat:@"/*!40101 SET NAMES '%@' */", [NSString stringWithString:[delegate valueForKey:@"_encoding"]]]]; if (delegate && [delegate respondsToSelector:@selector(connectionEncodingViaLatin1)]) { - if ([delegate connectionEncodingViaLatin1]) [self queryString:@"/*!40101 SET CHARACTER_SET_RESULTS=latin1 */"]; + if ([delegate connectionEncodingViaLatin1]) [self queryString:@"/*!40101 SET CHARACTER_SET_RESULTS=latin1 */"]; } } } @@ -958,8 +965,11 @@ static void forcePingTimeout(int signalNumber); - (void)setDelegate:(id)object { delegate = object; - delegateResponseToWillQueryString = (delegate && [delegate respondsToSelector:@selector(willQueryString:)]); - willQueryStringPtr = [delegate methodForSelector:@selector(willQueryString:)]; + + delegateResponseToWillQueryString = (delegate && [delegate respondsToSelector:willQueryStringSEL]); + + willQueryStringPtr = [delegate methodForSelector:willQueryStringSEL]; + } /* Getting the currently used time zone (in communication with the DB server). */ diff --git a/Source/CMMCPResult.m b/Source/CMMCPResult.m index 701e614c..ebc5c6ab 100644 --- a/Source/CMMCPResult.m +++ b/Source/CMMCPResult.m @@ -24,6 +24,7 @@ // More info at <http://code.google.com/p/sequel-pro/> #import "CMMCPResult.h" +#import "SPArrayAdditions.h" @implementation CMMCPResult @@ -295,7 +296,7 @@ modified version for use with sequel-pro switch (aType) { case MCPTypeDictionary : - [theReturn setObject:theCurrentObj forKey:[mNames objectAtIndex:i]]; + [theReturn setObject:theCurrentObj forKey:NSArrayObjectAtIndex(mNames, i)]; break; case MCPTypeArray : diff --git a/Source/CMTextView.m b/Source/CMTextView.m index 8e891b20..313a88bc 100644 --- a/Source/CMTextView.m +++ b/Source/CMTextView.m @@ -26,6 +26,7 @@ #import "CustomQuery.h" #import "TableDocument.h" #import "SPStringAdditions.h" +#import "SPArrayAdditions.h" #import "SPTextViewAdditions.h" #import "SPNarrowDownCompletion.h" @@ -138,7 +139,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) [queryResult dataSeek:0]; for (i = 0 ; i < [queryResult numOfRows] ; i++) { - [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:[[queryResult fetchRowAsArray] objectAtIndex:0], @"display", @"table-small-square", @"image", nil]]; + [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:NSArrayObjectAtIndex([queryResult fetchRowAsArray], 0), @"display", @"table-small-square", @"image", nil]]; //[possibleCompletions addObject:[[queryResult fetchRowAsArray] objectAtIndex:0]]; } @@ -158,7 +159,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) for (i = 0 ; i < [queryResult numOfRows] ; i++) { // [possibleCompletions addObject:[[queryResult fetchRowAsArray] objectAtIndex:0]]; - [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:[[queryResult fetchRowAsArray] objectAtIndex:0], @"display", @"database-small", @"image", nil]]; + [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:NSArrayObjectAtIndex([queryResult fetchRowAsArray], 0), @"display", @"database-small", @"image", nil]]; } // Add proc/func only for MySQL version 5 or higher @@ -170,7 +171,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) for (i = 0 ; i < [queryResult numOfRows] ; i++) { // [possibleCompletions addObject:[[queryResult fetchRowAsArray] objectAtIndex:1]]; - [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:[[queryResult fetchRowAsArray] objectAtIndex:1], @"display", @"proc-small", @"image", nil]]; + [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:NSArrayObjectAtIndex([queryResult fetchRowAsArray], 1), @"display", @"proc-small", @"image", nil]]; } // Add all function to completions list for currently selected table @@ -180,7 +181,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) for (i = 0 ; i < [queryResult numOfRows] ; i++) { // [possibleCompletions addObject:[[queryResult fetchRowAsArray] objectAtIndex:1]]; - [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:[[queryResult fetchRowAsArray] objectAtIndex:1], @"display", @"func-small", @"image", nil]]; + [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:NSArrayObjectAtIndex([queryResult fetchRowAsArray], 1), @"display", @"func-small", @"image", nil]]; } } @@ -988,7 +989,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) for (i = 0; i < [matchingCompletions count]; i++) { - NSString* obj = [matchingCompletions objectAtIndex:i]; + NSString* obj = NSArrayObjectAtIndex(matchingCompletions, i); if(![compl containsObject:obj]) if ([partialString isEqualToString:[obj substringToIndex:partialLength]]) // Matches case --> Insert at beginning of completion list diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m index b59fe084..eab76897 100644 --- a/Source/CustomQuery.m +++ b/Source/CustomQuery.m @@ -28,6 +28,7 @@ #import "SPGrowlController.h" #import "SPStringAdditions.h" #import "SPTextViewAdditions.h" +#import "SPArrayAdditions.h" #import "TableDocument.h" #import "TablesList.h" #import "RegexKitLite.h" @@ -410,14 +411,16 @@ // Remove all the columns theColumns = [customQueryView tableColumns]; while ([theColumns count]) { - [customQueryView removeTableColumn:[theColumns objectAtIndex:0]]; + [customQueryView removeTableColumn:NSArrayObjectAtIndex(theColumns, 0)]; } + long queryCount = [queries count]; + // Perform the supplied queries in series - for ( i = 0 ; i < [queries count] ; i++ ) { + for ( i = 0 ; i < queryCount ; i++ ) { // Don't run blank queries, or queries which only contain whitespace. - if ([[[queries objectAtIndex:i] stringByTrimmingCharactersInSet:whitespaceAndNewlineSet] length] == 0) + if ([[NSArrayObjectAtIndex(queries, i) stringByTrimmingCharactersInSet:whitespaceAndNewlineSet] length] == 0) continue; // Run the query, timing execution (note this also includes network and overhead) @@ -433,7 +436,7 @@ if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) { // If the query errored, append error to the error log for display at the end - if ( [queries count] > 1 ) { + if ( queryCount > 1 ) { if(firstErrorOccuredInQuery == -1) firstErrorOccuredInQuery = i+1; @@ -705,7 +708,7 @@ // the extra semicolon at the end of each query for (i = 0; i < queryCount; i++ ) { - queryRange = [[queries objectAtIndex:i] rangeValue]; + queryRange = [NSArrayObjectAtIndex(queries, i) rangeValue]; queryPosition = NSMaxRange(queryRange); queryStartPosition = queryRange.location; @@ -722,7 +725,7 @@ if (position == queryStartPosition) positionAssociatedWithPreviousQuery = YES; // If the caret is in between a user-defined delimiter whose length is >1, always associate - if (!positionAssociatedWithPreviousQuery && i && NSMaxRange([[queries objectAtIndex:i-1] rangeValue]) < position && position < queryStartPosition) positionAssociatedWithPreviousQuery = YES; + if (!positionAssociatedWithPreviousQuery && i && NSMaxRange([NSArrayObjectAtIndex(queries, i-1) rangeValue]) < position && position < queryStartPosition) positionAssociatedWithPreviousQuery = YES; // Otherwise associate if only whitespace since previous, and a newline before next. if (!positionAssociatedWithPreviousQuery) { @@ -742,7 +745,7 @@ } // If there is a previous query and the position should be associated with it, do so. - if (i && positionAssociatedWithPreviousQuery && [[[[textView string] substringWithRange:[[queries objectAtIndex:i-1] rangeValue]] stringByTrimmingCharactersInSet:whitespaceAndNewlineSet] length]) { + if (i && positionAssociatedWithPreviousQuery && [[[[textView string] substringWithRange:[NSArrayObjectAtIndex(queries, i-1) rangeValue]] stringByTrimmingCharactersInSet:whitespaceAndNewlineSet] length]) { queryRange = [[queries objectAtIndex:i-1] rangeValue]; break; } @@ -1053,8 +1056,8 @@ NSRunAlertPanel(@"Query already exists", @"The query you are adding to your favorites already exists.", @"OK", nil, nil); //remove row if it was a (blank) new row or a copied row - if ( [[queryFavorites objectAtIndex:rowIndex] isEqualToString:@""] || - [[queryFavorites objectAtIndex:rowIndex] isEqualToString:anObject] ) { + if ( [NSArrayObjectAtIndex(queryFavorites, rowIndex) isEqualToString:@""] || + [NSArrayObjectAtIndex(queryFavorites, rowIndex) isEqualToString:anObject] ) { [queryFavoritesView deselectAll:self]; [queryFavorites removeObjectAtIndex:rowIndex]; [queryFavoritesView reloadData]; diff --git a/Source/NoodleLineNumberView.m b/Source/NoodleLineNumberView.m index 2cd2508a..1743782b 100644 --- a/Source/NoodleLineNumberView.m +++ b/Source/NoodleLineNumberView.m @@ -31,6 +31,7 @@ // functionality and adds selection by clicking on the ruler. #import "NoodleLineNumberView.h" +#import "SPArrayAdditions.h" #define DEFAULT_THICKNESS 22.0 #define RULER_MARGIN 5.0 @@ -207,7 +208,7 @@ for (line = 0; line < count; line++) { - index = [[lines objectAtIndex:line] unsignedIntValue]; + index = [NSArrayObjectAtIndex(lines, line) unsignedIntValue]; rects = [layoutManager rectArrayForCharacterRange:NSMakeRange(index, 0) withinSelectedCharacterRange:nullRange @@ -299,7 +300,7 @@ while ((right - left) > 1) { mid = (right + left) / 2; - lineStart = [[lines objectAtIndex:mid] unsignedIntValue]; + lineStart = [NSArrayObjectAtIndex(lines, mid) unsignedIntValue]; if (index < lineStart) { @@ -405,7 +406,7 @@ for (line = [self lineNumberForCharacterIndex:range.location inText:text]; line < count; line++) { - index = [[lines objectAtIndex:line] unsignedIntValue]; + index = [NSArrayObjectAtIndex(lines, line) unsignedIntValue]; if (NSLocationInRange(index, range)) { diff --git a/Source/SPArrayAdditions.h b/Source/SPArrayAdditions.h index 7a672dc0..044699db 100644 --- a/Source/SPArrayAdditions.h +++ b/Source/SPArrayAdditions.h @@ -24,6 +24,15 @@ #import <Cocoa/Cocoa.h> +static inline id NSArrayObjectAtIndex(NSArray* self, NSUInteger i) { + typedef id (*SPArrayObjectAtIndexMethodPtr)(NSArray*, SEL, NSUInteger); + static SPArrayObjectAtIndexMethodPtr SPNSArrayObjectAtIndex; + if (!SPNSArrayObjectAtIndex) SPNSArrayObjectAtIndex = (SPArrayObjectAtIndexMethodPtr)[self methodForSelector:@selector(objectAtIndex:)]; + id to_return = SPNSArrayObjectAtIndex(self, @selector(objectAtIndex:), i); + return to_return; +} + + @interface NSArray (SPArrayAdditions) - (NSString *)componentsJoinedAndBacktickQuoted; diff --git a/Source/SPExportController.m b/Source/SPExportController.m index bd72c9d2..b76ea41f 100644 --- a/Source/SPExportController.m +++ b/Source/SPExportController.m @@ -24,6 +24,7 @@ #import "SPExportController.h" #import "TablesList.h" +#import "SPArrayAdditions.h" @implementation SPExportController @@ -78,7 +79,7 @@ for ( i = 0 ; i < [queryResult numOfRows] ; i++ ) { [tables addObject:[NSMutableArray arrayWithObjects: [NSNumber numberWithBool:YES], - [[queryResult fetchRowAsArray] objectAtIndex:0], + NSArrayObjectAtIndex([queryResult fetchRowAsArray], 0), nil ]]; } @@ -118,9 +119,9 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn id returnObject = nil; if ( [[aTableColumn identifier] isEqualToString:@"switch"] ) { - returnObject = [[tables objectAtIndex:rowIndex] objectAtIndex:0]; + returnObject = NSArrayObjectAtIndex([tables objectAtIndex:rowIndex], 0); } else { - returnObject = [[tables objectAtIndex:rowIndex] objectAtIndex:1]; + returnObject = NSArrayObjectAtIndex([tables objectAtIndex:rowIndex], 1); } return returnObject; diff --git a/Source/SPNarrowDownCompletion.m b/Source/SPNarrowDownCompletion.m index e5dc43ea..591b40d0 100644 --- a/Source/SPNarrowDownCompletion.m +++ b/Source/SPNarrowDownCompletion.m @@ -27,6 +27,7 @@ // More info at <http://code.google.com/p/sequel-pro/> #import "SPNarrowDownCompletion.h" +#import "SPArrayAdditions.h" #import "ImageAndTextCell.h" #import <Foundation/NSObjCRuntime.h> @@ -268,9 +269,9 @@ for(i=0; i<[newFiltered count]; i++) { if(dictMode) - item = [newFiltered objectAtIndex:i]; + item = NSArrayObjectAtIndex([newFiltered objectAtIndex:i], 0); else - item = [[newFiltered objectAtIndex:i] objectForKey:@"display"]; + item = [NSArrayObjectAtIndex([newFiltered objectAtIndex:i], 0) objectForKey:@"display"]; // If space in suggestion add space to allowed input chars if(!spaceInSuggestion && [item rangeOfString:@" "].length) { [textualInputCharacters addCharactersInString:@" "]; diff --git a/Source/SPQueryConsole.m b/Source/SPQueryConsole.m index dab9a9a0..d7f29811 100644 --- a/Source/SPQueryConsole.m +++ b/Source/SPQueryConsole.m @@ -25,6 +25,7 @@ #import "SPQueryConsole.h" #import "SPConsoleMessage.h" +#import "SPArrayAdditions.h" #define MESSAGE_TRUNCATE_CHARACTER_LENGTH 256 #define MESSAGE_TIME_STAMP_FORMAT @"%H:%M:%S" @@ -147,7 +148,7 @@ static SPQueryConsole *sharedQueryConsole = nil; while (i != NSNotFound) { if (i < [messagesVisibleSet count]) { - SPConsoleMessage *message = [messagesVisibleSet objectAtIndex:i]; + SPConsoleMessage *message = NSArrayObjectAtIndex(messagesVisibleSet, i); NSString *consoleMessage = [message message]; diff --git a/Source/SPTableData.m b/Source/SPTableData.m index f2e0c77e..8fd2f26c 100644 --- a/Source/SPTableData.m +++ b/Source/SPTableData.m @@ -31,6 +31,7 @@ #import "TableDocument.h" #import "TablesList.h" #import "SPStringAdditions.h" +#import "SPArrayAdditions.h" @implementation SPTableData @@ -339,10 +340,13 @@ tableColumn = [[NSMutableDictionary alloc] init]; definitionParts = [[NSMutableArray alloc] init]; fieldParser = [[SPSQLParser alloc] init]; + + NSCharacterSet *whitespaceAndNewlineSet = [NSCharacterSet whitespaceAndNewlineCharacterSet]; + for (i = 0; i < [fieldStrings count]; i++) { // Take this field/key string, trim whitespace from both ends and remove comments - [fieldsParser setString:[[fieldStrings objectAtIndex:i] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]]; + [fieldsParser setString:[NSArrayObjectAtIndex(fieldStrings, i) stringByTrimmingCharactersInSet:whitespaceAndNewlineSet]]; [fieldsParser deleteComments]; if (![fieldsParser length]) { continue; @@ -411,60 +415,60 @@ // NOTE: this won't get SET NULL | NO ACTION if( [[parts objectAtIndex:9] hasPrefix:@"UPDATE"] ) { //NSLog( @"update: %@", [parts objectAtIndex:10] ); - if( [[parts objectAtIndex:10] hasPrefix:@"SET"] ) { + if( [NSArrayObjectAtIndex(parts, 10) hasPrefix:@"SET"] ) { [constraintDetails setObject:@"SET NULL" forKey:@"update"]; nextOffs = 13; - } else if( [[parts objectAtIndex:10] hasPrefix:@"NO"] ) { + } else if( [NSArrayObjectAtIndex(parts, 10) hasPrefix:@"NO"] ) { [constraintDetails setObject:@"NO ACTION" forKey:@"update"]; nextOffs = 13; } else { - [constraintDetails setObject:[parts objectAtIndex:10] - forKey:@"update"]; + [constraintDetails setObject:NSArrayObjectAtIndex(parts, 10) + forKey:@"update"]; } } - else if( [[parts objectAtIndex:9] hasPrefix:@"DELETE"] ) { - //NSLog( @"delete: %@", [parts objectAtIndex:10] ); - if( [[parts objectAtIndex:10] hasPrefix:@"SET"] ) { + else if( [NSArrayObjectAtIndex(parts, 9) hasPrefix:@"DELETE"] ) { + //NSLog( @"delete: %@", [parts objectAtIndex:10] ); + if( [NSArrayObjectAtIndex(parts, 10) hasPrefix:@"SET"] ) { [constraintDetails setObject:@"SET NULL" forKey:@"delete"]; nextOffs = 13; - } else if( [[parts objectAtIndex:10] hasPrefix:@"NO"] ) { + } else if( [NSArrayObjectAtIndex(parts, 10) hasPrefix:@"NO"] ) { [constraintDetails setObject:@"NO ACTION" forKey:@"delete"]; nextOffs = 13; } else { - [constraintDetails setObject:[parts objectAtIndex:10] - forKey:@"delete"]; + [constraintDetails setObject:NSArrayObjectAtIndex(parts, 10) + forKey:@"delete"]; } } } if( [parts count] > nextOffs - 1 ) { - if( [[parts objectAtIndex:nextOffs] hasPrefix:@"UPDATE"] ) { + if( [NSArrayObjectAtIndex(parts, nextOffs) hasPrefix:@"UPDATE"] ) { //NSLog( @"update: %@", [parts objectAtIndex:13] ); - if( [[parts objectAtIndex:nextOffs+1] hasPrefix:@"SET"] ) { + if( [NSArrayObjectAtIndex(parts, nextOffs+1) hasPrefix:@"SET"] ) { [constraintDetails setObject:@"SET NULL" forKey:@"update"]; - } else if( [[parts objectAtIndex:nextOffs+1] hasPrefix:@"NO"] ) { + } else if( [NSArrayObjectAtIndex(parts, nextOffs+1) hasPrefix:@"NO"] ) { [constraintDetails setObject:@"NO ACTION" forKey:@"update"]; } else { - [constraintDetails setObject:[parts objectAtIndex:nextOffs+1] - forKey:@"update"]; + [constraintDetails setObject:NSArrayObjectAtIndex(parts, nextOffs+1) + forKey:@"update"]; } } - else if( [[parts objectAtIndex:nextOffs] hasPrefix:@"DELETE"] ) { - //NSLog( @"delete: %@", [parts objectAtIndex:13] ); - if( [[parts objectAtIndex:nextOffs+1] hasPrefix:@"SET"] ) { + else if( [NSArrayObjectAtIndex(parts, nextOffs) hasPrefix:@"DELETE"] ) { + //NSLog( @"delete: %@", [parts objectAtIndex:13] ); + if( [NSArrayObjectAtIndex(parts, nextOffs+1) hasPrefix:@"SET"] ) { [constraintDetails setObject:@"SET NULL" forKey:@"delete"]; - } else if( [[parts objectAtIndex:nextOffs+1] hasPrefix:@"NO"] ) { + } else if( [NSArrayObjectAtIndex(parts, nextOffs+1) hasPrefix:@"NO"] ) { [constraintDetails setObject:@"NO ACTION" forKey:@"delete"]; } else { - [constraintDetails setObject:[parts objectAtIndex:nextOffs+1] - forKey:@"delete"]; + [constraintDetails setObject:NSArrayObjectAtIndex(parts, nextOffs+1) + forKey:@"delete"]; } } } @@ -472,11 +476,11 @@ [constraintDetails release]; } // primary key - else if( [[parts objectAtIndex:0] hasPrefix:@"PRIMARY"] ) { - //NSLog( @"pkey is %@", [[parts objectAtIndex:2] stringByTrimmingCharactersInSet:junk] ); + else if( [NSArrayObjectAtIndex(parts, 0) hasPrefix:@"PRIMARY"] ) { + //NSLog( @"pkey is %@", [[parts objectAtIndex:2] stringByTrimmingCharactersInSet:junk] ); } // key - else if( [[parts objectAtIndex:0] hasPrefix:@"KEY"] ) { + else if( [NSArrayObjectAtIndex(parts, 0) hasPrefix:@"KEY"] ) { /* NSLog( @"key %@.%@", [[parts objectAtIndex:1] stringByTrimmingCharactersInSet:junk], diff --git a/Source/TableContent.m b/Source/TableContent.m index bbda4d44..4d68ce1f 100644 --- a/Source/TableContent.m +++ b/Source/TableContent.m @@ -109,7 +109,7 @@ theColumns = [tableContentView tableColumns]; while ([theColumns count]) { - [tableContentView removeTableColumn:[theColumns objectAtIndex:0]]; + [tableContentView removeTableColumn:NSArrayObjectAtIndex(theColumns, 0)]; } // If no table has been supplied, reset the view to a blank table and disabled elements. @@ -167,7 +167,7 @@ // Add the new columns to the table for ( i = 0 ; i < [theColumns count] ; i++ ) { - columnDefinition = [theColumns objectAtIndex:i]; + columnDefinition = NSArrayObjectAtIndex(theColumns, i); // Set up the column theCol = [[NSTableColumn alloc] initWithIdentifier:[columnDefinition objectForKey:@"name"]]; @@ -718,7 +718,7 @@ columns = [[NSArray alloc] initWithArray:[tableDataInstance columns]]; for ( i = 0 ; i < [columns count] ; i++ ) { - column = [columns objectAtIndex:i]; + column = NSArrayObjectAtIndex(columns, i); if ([column objectForKey:@"default"] == nil || [[column objectForKey:@"default"] isEqualToString:@"NULL"]) { [newRow setObject:[prefs stringForKey:@"NullValue"] forKey:[column objectForKey:@"name"]]; } else { @@ -1438,8 +1438,8 @@ // Add values for hidden blob and text fields if appropriate if ( [prefs boolForKey:@"LoadBlobsAsNeeded"] ) { for ( j = 0 ; j < [columns count] ; j++ ) { - if ( [tableDataInstance columnIsBlobOrText:[[columns objectAtIndex:j] objectForKey:@"name"] ] ) { - [modifiedRow setObject:NSLocalizedString(@"(not loaded)", @"value shown for hidden blob and text fields") forKey:[[columns objectAtIndex:j] objectForKey:@"name"]]; + if ( [tableDataInstance columnIsBlobOrText:[NSArrayObjectAtIndex(columns, j) objectForKey:@"name"] ] ) { + [modifiedRow setObject:NSLocalizedString(@"(not loaded)", @"value shown for hidden blob and text fields") forKey:[NSArrayObjectAtIndex(columns, j) objectForKey:@"name"]]; } } } @@ -1489,7 +1489,7 @@ NSMutableArray *fieldValues = [[NSMutableArray alloc] init]; // Get the field values for ( i = 0 ; i < [columnNames count] ; i++ ) { - rowObject = [[filteredResult objectAtIndex:currentlyEditingRow] objectForKey:[columnNames objectAtIndex:i]]; + rowObject = [NSArrayObjectAtIndex(filteredResult, currentlyEditingRow) objectForKey:NSArrayObjectAtIndex(columnNames, i)]; // Convert the object to a string (here we can add special treatment for date-, number- and data-fields) if ( [[rowObject description] isEqualToString:[prefs stringForKey:@"NullValue"]] || ([rowObject isMemberOfClass:[NSString class]] && [[rowObject description] isEqualToString:@""]) ) { @@ -1510,7 +1510,7 @@ } else { if ( [[rowObject description] isEqualToString:@"CURRENT_TIMESTAMP"] ) { [rowValue setString:@"CURRENT_TIMESTAMP"]; - } else if ([[[theColumns objectAtIndex:i] objectForKey:@"typegrouping"] isEqualToString:@"bit"]) { + } else if ([[NSArrayObjectAtIndex(theColumns, i) objectForKey:@"typegrouping"] isEqualToString:@"bit"]) { [rowValue setString:((![[rowObject description] length] || [[rowObject description] isEqualToString:@"0"])?@"0":@"1")]; } else { [rowValue setString:[NSString stringWithFormat:@"'%@'", [mySQLConnection prepareString:[rowObject description]]]]; @@ -1533,7 +1533,7 @@ [queryString appendString:@", "]; } [queryString appendString:[NSString stringWithFormat:@"%@=%@", - [[columnNames objectAtIndex:i] backtickQuotedString], [fieldValues objectAtIndex:i]]]; + [NSArrayObjectAtIndex(columnNames, i) backtickQuotedString], [fieldValues objectAtIndex:i]]]; } [queryString appendString:[NSString stringWithFormat:@" WHERE %@", [self argumentForRow:-2]]]; } @@ -1570,9 +1570,9 @@ // Set the insertId for fields with auto_increment for ( i = 0; i < [theColumns count] ; i++ ) { - if ([[[theColumns objectAtIndex:i] objectForKey:@"autoincrement"] intValue]) { + if ([[NSArrayObjectAtIndex(theColumns, i) objectForKey:@"autoincrement"] intValue]) { [[filteredResult objectAtIndex:currentlyEditingRow] setObject:[[NSNumber numberWithLong:[mySQLConnection insertId]] description] - forKey:[columnNames objectAtIndex:i]]; + forKey:NSArrayObjectAtIndex(columnNames, i)]; } } [fullResult addObject:[filteredResult objectAtIndex:currentlyEditingRow]]; @@ -1710,11 +1710,11 @@ // Use the selected row if appropriate if ( row >= 0 ) { - tempValue = [[filteredResult objectAtIndex:row] objectForKey:[keys objectAtIndex:i]]; + tempValue = [NSArrayObjectAtIndex(filteredResult, row) objectForKey:NSArrayObjectAtIndex(keys, i)]; // Otherwise use the oldRow } else { - tempValue = [oldRow objectForKey:[keys objectAtIndex:i]]; + tempValue = [oldRow objectForKey:NSArrayObjectAtIndex(keys, i)]; } if ( [tempValue isKindOfClass:[NSData class]] ) { @@ -1728,7 +1728,7 @@ } if ( [value isEqualToString:[prefs stringForKey:@"NullValue"]] ) { - [argument appendString:[NSString stringWithFormat:@"%@ IS NULL", [[keys objectAtIndex:i] backtickQuotedString]]]; + [argument appendString:[NSString stringWithFormat:@"%@ IS NULL", [NSArrayObjectAtIndex(keys, i) backtickQuotedString]]]; } else { // Escape special characters (in WHERE statement!) @@ -1750,9 +1750,9 @@ columnType = [[tableDataInstance columnWithName:[keys objectAtIndex:i]] objectForKey:@"typegrouping"]; if ( [columnType isEqualToString:@"integer"] || [columnType isEqualToString:@"float"] || [columnType isEqualToString:@"bit"] ) { - [argument appendString:[NSString stringWithFormat:@"%@ = %@", [[keys objectAtIndex:i] backtickQuotedString], value]]; + [argument appendString:[NSString stringWithFormat:@"%@ = %@", [NSArrayObjectAtIndex(keys, i) backtickQuotedString], value]]; } else { - [argument appendString:[NSString stringWithFormat:@"%@ LIKE %@", [[keys objectAtIndex:i] backtickQuotedString], value]]; + [argument appendString:[NSString stringWithFormat:@"%@ LIKE %@", [NSArrayObjectAtIndex(keys, i) backtickQuotedString], value]]; } } } @@ -1772,7 +1772,7 @@ NSArray *tableColumns = [tableDataInstance columns]; for ( i = 0 ; i < [tableColumns count]; i++ ) { - if ( [tableDataInstance columnIsBlobOrText:[[tableColumns objectAtIndex:i] objectForKey:@"name"]] ) { + if ( [tableDataInstance columnIsBlobOrText:[NSArrayObjectAtIndex(tableColumns, i) objectForKey:@"name"]] ) { return YES; } } @@ -1793,14 +1793,14 @@ if ( [prefs boolForKey:@"LoadBlobsAsNeeded"] ) { for ( i = 0 ; i < [columnNames count] ; i++ ) { - if (![tableDataInstance columnIsBlobOrText:[[columns objectAtIndex:i] objectForKey:@"name"]] ) { - [fields addObject:[columnNames objectAtIndex:i]]; + if (![tableDataInstance columnIsBlobOrText:[NSArrayObjectAtIndex(columns, i) objectForKey:@"name"]] ) { + [fields addObject:NSArrayObjectAtIndex(columnNames, i)]; } } // Always select at least one field - the first if there are no non-blob fields. if ( [fields count] == 0 ) { - return [[columnNames objectAtIndex:0] backtickQuotedString]; + return [NSArrayObjectAtIndex(columnNames, 0) backtickQuotedString]; } else { return [fields componentsJoinedAndBacktickQuoted]; } @@ -1893,7 +1893,7 @@ } else { for ( i = 0 ; i < [filteredResult count] ; i++ ) { if ( ![tempArray containsObject:[NSNumber numberWithInt:i]] ) - [tempResult addObject:[filteredResult objectAtIndex:i]]; + [tempResult addObject:NSArrayObjectAtIndex(filteredResult, i)]; } [filteredResult setArray:tempResult]; numRows = [self getNumberOfRows]; @@ -2431,7 +2431,7 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn // Check if next column is a blob column, and skip to the next non-blob column i = 1; while ( - (fieldType = [[tableDataInstance columnWithName:[[[tableContentView tableColumns] objectAtIndex:column+i] identifier]] objectForKey:@"typegrouping"]) + (fieldType = [[tableDataInstance columnWithName:[NSArrayObjectAtIndex([tableContentView tableColumns], column+i) identifier]] objectForKey:@"typegrouping"]) && ([fieldType isEqualToString:@"textdata"] || [fieldType isEqualToString:@"blobdata"]) ) { i++; diff --git a/Source/TableDocument.m b/Source/TableDocument.m index 270ebe5b..f98a2c1c 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -40,6 +40,7 @@ #import "SPTableData.h" #import "SPDatabaseData.h" #import "SPStringAdditions.h" +#import "SPArrayAdditions.h" #import "SPQueryConsole.h" #import "CMMCPConnection.h" #import "CMMCPResult.h" @@ -794,7 +795,7 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum for (i = 0 ; i < [queryResult numOfRows] ; i++) { - [chooseDatabaseButton addItemWithTitle:[[queryResult fetchRowAsArray] objectAtIndex:0]]; + [chooseDatabaseButton addItemWithTitle:NSArrayObjectAtIndex([queryResult fetchRowAsArray], 0)]; } (![self database]) ? [chooseDatabaseButton selectItemAtIndex:0] : [chooseDatabaseButton selectItemWithTitle:[self database]]; @@ -951,7 +952,7 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum int r = [theResult numOfRows]; if (r) [theResult dataSeek:0]; for ( i = 0 ; i < r ; i++ ) { - dbName = [[theResult fetchRowAsArray] objectAtIndex:0]; + dbName = NSArrayObjectAtIndex([theResult fetchRowAsArray], 0); } if(![dbName isKindOfClass:[NSNull class]]) { if(![dbName isEqualToString:selectedDatabase]) { diff --git a/Source/TableDump.m b/Source/TableDump.m index a309c22a..1490299a 100644 --- a/Source/TableDump.m +++ b/Source/TableDump.m @@ -53,7 +53,7 @@ if ([queryResult numOfRows]) [queryResult dataSeek:0]; for ( i = 0 ; i < [queryResult numOfRows] ; i++ ) { [tables addObject:[NSMutableArray arrayWithObjects: - [NSNumber numberWithBool:YES], [[queryResult fetchRowAsArray] objectAtIndex:0], nil]]; + [NSNumber numberWithBool:YES], NSArrayObjectAtIndex([queryResult fetchRowAsArray], 0), nil]]; } [exportDumpTableView reloadData]; @@ -481,10 +481,9 @@ if (importSQLAsUTF8) for ( i = 0 ; i < queryCount ; i++ ) { [singleProgressBar setDoubleValue:(i*100/queryCount)]; - // [singleProgressBar displayIfNeeded]; // Skip blank or whitespace-only queries to avoid errors - NSString *q = [[queries objectAtIndex:i] stringByTrimmingCharactersInSet:whitespaceAndNewline]; + NSString *q = [NSArrayObjectAtIndex(queries, i) stringByTrimmingCharactersInSet:whitespaceAndNewline]; if (![q length]) continue; [mySQLConnection queryString:q usingEncoding:NSUTF8StringEncoding]; @@ -496,10 +495,9 @@ else for ( i = 0 ; i < queryCount ; i++ ) { [singleProgressBar setDoubleValue:(i*100/queryCount)]; - // [singleProgressBar displayIfNeeded]; // Skip blank or whitespace-only queries to avoid errors - NSString *q = [[queries objectAtIndex:i] stringByTrimmingCharactersInSet:whitespaceAndNewline]; + NSString *q = [NSArrayObjectAtIndex(queries, i) stringByTrimmingCharactersInSet:whitespaceAndNewline]; if (![q length]) continue; [mySQLConnection queryString:q]; @@ -591,7 +589,7 @@ theResult = (CMMCPResult *) [mySQLConnection listTables]; if ([theResult numOfRows]) [theResult dataSeek:0]; for ( i = 0 ; i < [theResult numOfRows] ; i++ ) { - [fieldMappingPopup addItemWithTitle:[[theResult fetchRowAsArray] objectAtIndex:0]]; + [fieldMappingPopup addItemWithTitle:NSArrayObjectAtIndex([theResult fetchRowAsArray], 0)]; } if ([tableDocumentInstance table] != nil && ![(NSString *)[tableDocumentInstance table] isEqualToString:@""]) { @@ -655,19 +653,20 @@ // get fields to be imported for (i = 0; i < [fieldMappingArray count] ; i++ ) { - if ([[fieldMappingArray objectAtIndex:i] intValue] > 0) { + if ([NSArrayObjectAtIndex(fieldMappingArray, i) intValue] > 0) { if ( [fNames length] ) [fNames appendString:@","]; - [fNames appendString:[[[tableSourceInstance fieldNames] objectAtIndex:i] backtickQuotedString]]; + [fNames appendString:[NSArrayObjectAtIndex([tableSourceInstance fieldNames], i) backtickQuotedString]]; } } //import array - for ( i = 0 ; i < [importArray count] ; i++ ) { + long importArrayCount = [importArray count]; + for ( i = 0 ; i < importArrayCount ; i++ ) { //show progress bar - [singleProgressBar setDoubleValue:((i+1)*100/[importArray count])]; - [singleProgressBar displayIfNeeded]; + [singleProgressBar setDoubleValue:((i+1)*100/importArrayCount)]; + // [singleProgressBar displayIfNeeded]; if ( !([importFieldNamesSwitch state] && (i == 0)) ) { //put values in string @@ -675,14 +674,14 @@ for ( j = 0 ; j < [fieldMappingArray count] ; j++ ) { - if ([[fieldMappingArray objectAtIndex:j] intValue] > 0) { + if ([NSArrayObjectAtIndex(fieldMappingArray,j) intValue] > 0) { if ( [fValues length] ) [fValues appendString:@","]; - if ([[[importArray objectAtIndex:i] objectAtIndex:([[fieldMappingArray objectAtIndex:j] intValue] - 1)] isMemberOfClass:[NSNull class]] ) { + if ([[NSArrayObjectAtIndex(importArray, i) objectAtIndex:([NSArrayObjectAtIndex(fieldMappingArray, j) intValue] - 1)] isMemberOfClass:[NSNull class]] ) { [fValues appendString:@"NULL"]; } else { - [fValues appendString:[NSString stringWithFormat:@"'%@'",[mySQLConnection prepareString:[[importArray objectAtIndex:i] objectAtIndex:([[fieldMappingArray objectAtIndex:j] intValue] - 1)]]]]; + [fValues appendString:[NSString stringWithFormat:@"'%@'",[mySQLConnection prepareString:[NSArrayObjectAtIndex(importArray ,i) objectAtIndex:([NSArrayObjectAtIndex(fieldMappingArray ,j) intValue] - 1)]]]]; } } } @@ -694,7 +693,7 @@ fValues]]; if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) { - [errors appendString:[NSString stringWithFormat:NSLocalizedString(@"[ERROR in line %d] %@\n", @"error text when reading of csv file gave errors"), (i+1),[mySQLConnection getLastErrorMessage]]]; + [errors appendString:[NSString stringWithFormat:NSLocalizedString(@"[ERROR in line %d] %@\n", @"error text when reading of csv file gave errors"), (i+1),[mySQLConnection getLastErrorMessage]]]; } } } @@ -759,8 +758,8 @@ if (!fieldMappingArray) { fieldMappingArray = [NSMutableArray array]; - for (i = 0; i < [[tableSourceInstance fieldNames] count]; i++) { - if (i < [[importArray objectAtIndex:currentRow] count] && ![[[importArray objectAtIndex:currentRow] objectAtIndex:i] isKindOfClass:[NSNull class]]) { + for (i = 0; i < [[tableSourceInstance fieldNames] count]; i++) { + if (i < [NSArrayObjectAtIndex(importArray, currentRow) count] && ![NSArrayObjectAtIndex(NSArrayObjectAtIndex(importArray, currentRow), i) isKindOfClass:[NSNull class]]) { value = i + 1; } else { value = 0; @@ -785,7 +784,7 @@ if ([[fieldMappingButtonOptions objectAtIndex:i] isNSNull]) { [fieldMappingButtonOptions replaceObjectAtIndex:i withObject:[NSString stringWithFormat:@"%i. %@", i+1, [prefs objectForKey:@"NullValue"]]]; } else { - [fieldMappingButtonOptions replaceObjectAtIndex:i withObject:[NSString stringWithFormat:@"%i. %@", i+1, [fieldMappingButtonOptions objectAtIndex:i]]]; + [fieldMappingButtonOptions replaceObjectAtIndex:i withObject:[NSString stringWithFormat:@"%i. %@", i+1, NSArrayObjectAtIndex(fieldMappingButtonOptions, i)]]; } } } @@ -855,8 +854,8 @@ // Copy over the selected table names into a table in preparation for iteration for ( i = 0 ; i < [tables count] ; i++ ) { - if ( [[[tables objectAtIndex:i] objectAtIndex:0] boolValue] ) { - [selectedTables addObject:[NSString stringWithString:[[tables objectAtIndex:i] objectAtIndex:1]]]; + if ( [NSArrayObjectAtIndex(NSArrayObjectAtIndex(tables, i), 0) boolValue] ) { + [selectedTables addObject:[NSString stringWithString:NSArrayObjectAtIndex(NSArrayObjectAtIndex(tables, i), 1)]]; } } @@ -899,7 +898,7 @@ lastProgressValue = 0; // Update the progress text and reset the progress bar to indeterminate status while fetching data - tableName = [selectedTables objectAtIndex:i]; + tableName = NSArrayObjectAtIndex(selectedTables, i); [singleProgressText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Table %i of %i (%@): Fetching data...", @"text showing that app is fetching data for table dump"), (i+1), [selectedTables count], tableName]]; [singleProgressText displayIfNeeded]; [singleProgressBar setIndeterminate:YES]; @@ -958,7 +957,7 @@ colCount = [[tableDetails objectForKey:@"columns"] count]; tableColumnNumericStatus = [NSMutableArray arrayWithCapacity:colCount]; for ( j = 0; j < colCount ; j++ ) { - tableColumnTypeGrouping = [[[tableDetails objectForKey:@"columns"] objectAtIndex:j] objectForKey:@"typegrouping"]; + tableColumnTypeGrouping = [NSArrayObjectAtIndex([tableDetails objectForKey:@"columns"], j) objectForKey:@"typegrouping"]; if ([tableColumnTypeGrouping isEqualToString:@"bit"] || [tableColumnTypeGrouping isEqualToString:@"integer"] || [tableColumnTypeGrouping isEqualToString:@"float"]) { [tableColumnNumericStatus addObject:[NSNumber numberWithBool:YES]]; @@ -1212,19 +1211,19 @@ cinfo = [tinfo objectForKey:@"constraints"]; for( int j = 0; j < [cinfo count]; j++ ) { // get the column refs. these can be comma separated. - NSString *ccol = [[cinfo objectAtIndex:j] objectForKey:@"columns"]; - NSString *rcol = [[cinfo objectAtIndex:j] objectForKey:@"ref_columns"]; + NSString *ccol = [NSArrayObjectAtIndex(cinfo, j) objectForKey:@"columns"]; + NSString *rcol = [NSArrayObjectAtIndex(cinfo, j) objectForKey:@"ref_columns"]; NSString *extra = @""; NSArray *tc = [ccol componentsSeparatedByString:@","]; if( [tc count] > 1 ) { extra = @" [ arrowhead=crow, arrowtail=odiamond ]"; - ccol = [tc objectAtIndex:0]; - rcol = [[ccol componentsSeparatedByString:@","] objectAtIndex:0]; + ccol = NSArrayObjectAtIndex(tc, 0); + rcol = NSArrayObjectAtIndex([ccol componentsSeparatedByString:@","], 0); } [fkInfo addObject:[NSString stringWithFormat:@"%@:%@ -> %@:%@ %@", tableName, ccol, - [[cinfo objectAtIndex:j] objectForKey:@"ref_table"], + [NSArrayObjectAtIndex(cinfo, j) objectForKey:@"ref_table"], rcol, extra ]]; @@ -1328,7 +1327,7 @@ // Set the progress text [singleProgressText setStringValue:NSLocalizedString(@"Exporting...", @"text showing that app is exporting to text file")]; - [singleProgressText displayIfNeeded]; + // [singleProgressText displayIfNeeded]; // Open progress sheet @@ -1372,7 +1371,7 @@ [csvRow setArray:[queryResult fetchRowAsArray]]; } } else { - [csvRow setArray:[array objectAtIndex:i]]; + [csvRow setArray:NSArrayObjectAtIndex(array, i)]; } [csvString setString:@""]; @@ -1386,14 +1385,14 @@ } // Retrieve the contents of this cell - if ([[csvRow objectAtIndex:j] isKindOfClass:[NSData class]]) { - dataConversionString = [[NSString alloc] initWithData:[csvRow objectAtIndex:j] encoding:tableEncoding]; + if ([NSArrayObjectAtIndex(csvRow, j) isKindOfClass:[NSData class]]) { + dataConversionString = [[NSString alloc] initWithData:NSArrayObjectAtIndex(csvRow, j) encoding:tableEncoding]; if (dataConversionString == nil) - dataConversionString = [[NSString alloc] initWithData:[csvRow objectAtIndex:j] encoding:NSASCIIStringEncoding]; + dataConversionString = [[NSString alloc] initWithData:NSArrayObjectAtIndex(csvRow, j) encoding:NSASCIIStringEncoding]; [csvCell setString:[NSString stringWithString:dataConversionString]]; [dataConversionString release]; } else { - [csvCell setString:[[csvRow objectAtIndex:j] description]]; + [csvCell setString:[NSArrayObjectAtIndex(csvRow, j) description]]; } // For NULL values supplied via an array add the unenclosed null string as set in preferences @@ -1408,12 +1407,12 @@ } else { // Test whether this cell contains a number - if ([[csvRow objectAtIndex:j] isKindOfClass:[NSData class]]) { + if ([NSArrayObjectAtIndex(csvRow, j) isKindOfClass:[NSData class]]) { csvCellIsNumeric = FALSE; // If an array of bools supplying information as to whether the column is numeric has been supplied, use it. } else if (tableColumnNumericStatus != nil) { - csvCellIsNumeric = [[tableColumnNumericStatus objectAtIndex:j] boolValue]; + csvCellIsNumeric = [NSArrayObjectAtIndex(tableColumnNumericStatus, j) boolValue]; // Or fall back to testing numeric content via an NSScanner. } else { diff --git a/Source/TablesList.m b/Source/TablesList.m index 1cd8d8de..fd794cfc 100644 --- a/Source/TablesList.m +++ b/Source/TablesList.m @@ -33,6 +33,7 @@ #import "CMMCPConnection.h" #import "CMMCPResult.h" #import "SPStringAdditions.h" +#import "SPArrayAdditions.h" #import "RegexKitLite.h" @implementation TablesList @@ -105,21 +106,21 @@ if( [theResult numOfFields] == 1 ) { for( i = 0; i < [theResult numOfRows]; i++ ) { - [tables addObject:[[theResult fetchRowAsArray] objectAtIndex:3]]; - if( [[[theResult fetchRowAsArray] objectAtIndex:4] isEqualToString:@"PROCEDURE"]) { - [tableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_PROC]]; + [tables addObject:NSArrayObjectAtIndex([theResult fetchRowAsArray],3)]; + if( [NSArrayObjectAtIndex([theResult fetchRowAsArray], 4) isEqualToString:@"PROCEDURE"]) { + [tableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_PROC]]; } else { - [tableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_FUNC]]; + [tableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_FUNC]]; } } } else { for( i = 0; i < [theResult numOfRows]; i++ ) { resultRow = [theResult fetchRowAsArray]; - [tables addObject:[resultRow objectAtIndex:3]]; - if( [[resultRow objectAtIndex:4] isEqualToString:@"PROCEDURE"] ) { - [tableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_PROC]]; + [tables addObject:NSArrayObjectAtIndex(resultRow, 3)]; + if( [NSArrayObjectAtIndex(resultRow, 4) isEqualToString:@"PROCEDURE"] ) { + [tableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_PROC]]; } else { - [tableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_FUNC]]; + [tableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_FUNC]]; } } } diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj index 831aa666..3e283c81 100644 --- a/sequel-pro.xcodeproj/project.pbxproj +++ b/sequel-pro.xcodeproj/project.pbxproj @@ -1490,7 +1490,7 @@ buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_BIT)"; GCC_C_LANGUAGE_STANDARD = c99; - GCC_OPTIMIZATION_LEVEL = 0; + GCC_OPTIMIZATION_LEVEL = 3; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IBC_FLATTEN_NIBS = NO; |