aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjakob <jakob@eggerapps.at>2010-01-28 13:32:13 +0000
committerjakob <jakob@eggerapps.at>2010-01-28 13:32:13 +0000
commitfbd0ed3df36e13e6ffd56b55162e1834be82d4f2 (patch)
treea83e0e06a85fe18e9f27d60299a271e252c10db6
parent80120555be28a2ec1384ea05006c43c77857a0a0 (diff)
downloadsequelpro-fbd0ed3df36e13e6ffd56b55162e1834be82d4f2.tar.gz
sequelpro-fbd0ed3df36e13e6ffd56b55162e1834be82d4f2.tar.bz2
sequelpro-fbd0ed3df36e13e6ffd56b55162e1834be82d4f2.zip
* renaming a table/view/proc/func now doesn't open a sheet anymore
* table name checks now correctly consider only functions when working with functions * when an empty table name is entered, the change is ignored (like in finder)
-rw-r--r--Interfaces/English.lproj/DBView.xib544
-rw-r--r--Source/TablesList.h4
-rw-r--r--Source/TablesList.m230
3 files changed, 214 insertions, 564 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib
index cec05aa8..a4db02ad 100644
--- a/Interfaces/English.lproj/DBView.xib
+++ b/Interfaces/English.lproj/DBView.xib
@@ -18,7 +18,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<string>740</string>
<string>740</string>
- <string>1.2.1</string>
+ <string>1.2.5</string>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
@@ -1691,6 +1691,7 @@
<bool key="BWGBHasTopBorder">NO</bool>
<bool key="BWGBHasBottomBorder">NO</bool>
<bool key="BWGBHasGradient">NO</bool>
+ <bool key="BWGBHasFillColor">NO</bool>
<float key="BWGBTopInsetAlpha">0.0</float>
<float key="BWGBBottomInsetAlpha">0.0</float>
</object>
@@ -5956,107 +5957,6 @@
<string key="NSMinSize">{260, 149}</string>
<string key="NSMaxSize">{600, 149}</string>
</object>
- <object class="NSWindowTemplate" id="399092485">
- <int key="NSWindowStyleMask">9</int>
- <int key="NSWindowBacking">2</int>
- <string key="NSWindowRect">{{343, 483}, {260, 112}}</string>
- <int key="NSWTFlags">1886912512</int>
- <string key="NSWindowTitle">Rename Table</string>
- <string key="NSWindowClass">NSWindow</string>
- <object class="NSMutableString" key="NSViewClass">
- <characters key="NS.bytes">View</characters>
- </object>
- <string key="NSWindowContentMaxSize">{600, 112}</string>
- <string key="NSWindowContentMinSize">{260, 112}</string>
- <object class="NSView" key="NSWindowView" id="44272488">
- <nil key="NSNextResponder"/>
- <int key="NSvFlags">256</int>
- <object class="NSMutableArray" key="NSSubviews">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSTextField" id="731300775">
- <reference key="NSNextResponder" ref="44272488"/>
- <int key="NSvFlags">266</int>
- <string key="NSFrame">{{17, 78}, {235, 14}}</string>
- <reference key="NSSuperview" ref="44272488"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="487237473">
- <int key="NSCellFlags">67239488</int>
- <int key="NSCellFlags2">4196864</int>
- <string key="NSContents">Rename table %@ to:</string>
- <reference key="NSSupport" ref="26"/>
- <reference key="NSControlView" ref="731300775"/>
- <reference key="NSBackgroundColor" ref="62854682"/>
- <reference key="NSTextColor" ref="454249633"/>
- </object>
- </object>
- <object class="NSTextField" id="272856728">
- <reference key="NSNextResponder" ref="44272488"/>
- <int key="NSvFlags">258</int>
- <string key="NSFrame">{{20, 52}, {220, 18}}</string>
- <reference key="NSSuperview" ref="44272488"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="859957158">
- <int key="NSCellFlags">-1804468671</int>
- <int key="NSCellFlags2">4326400</int>
- <string key="NSContents"/>
- <reference key="NSSupport" ref="26"/>
- <reference key="NSControlView" ref="272856728"/>
- <bool key="NSDrawsBackground">YES</bool>
- <reference key="NSBackgroundColor" ref="480189472"/>
- <reference key="NSTextColor" ref="690893883"/>
- </object>
- </object>
- <object class="NSButton" id="994798282">
- <reference key="NSNextResponder" ref="44272488"/>
- <int key="NSvFlags">289</int>
- <string key="NSFrame">{{166, 13}, {79, 28}}</string>
- <reference key="NSSuperview" ref="44272488"/>
- <int key="NSTag">1</int>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="825486974">
- <int key="NSCellFlags">604110336</int>
- <int key="NSCellFlags2">138018816</int>
- <string key="NSContents">Rename</string>
- <reference key="NSSupport" ref="26"/>
- <reference key="NSControlView" ref="994798282"/>
- <int key="NSTag">1</int>
- <int key="NSButtonFlags">-2038284033</int>
- <int key="NSButtonFlags2">1</int>
- <reference key="NSAlternateImage" ref="932958253"/>
- <string key="NSAlternateContents"/>
- <string type="base64-UTF8" key="NSKeyEquivalent">DQ</string>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- </object>
- <object class="NSButton" id="88145988">
- <reference key="NSNextResponder" ref="44272488"/>
- <int key="NSvFlags">257</int>
- <string key="NSFrame">{{91, 13}, {77, 28}}</string>
- <reference key="NSSuperview" ref="44272488"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="875831639">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">138018816</int>
- <string key="NSContents">Cancel</string>
- <reference key="NSSupport" ref="26"/>
- <reference key="NSControlView" ref="88145988"/>
- <int key="NSButtonFlags">-2038284033</int>
- <int key="NSButtonFlags2">1</int>
- <reference key="NSAlternateImage" ref="932958253"/>
- <string key="NSAlternateContents"/>
- <string type="base64-UTF8" key="NSKeyEquivalent">Gw</string>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- </object>
- </object>
- <string key="NSFrameSize">{260, 112}</string>
- </object>
- <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
- <string key="NSMinSize">{260, 134}</string>
- <string key="NSMaxSize">{600, 134}</string>
- </object>
<object class="NSWindowTemplate" id="549044462">
<int key="NSWindowStyleMask">1</int>
<int key="NSWindowBacking">2</int>
@@ -12973,30 +12873,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<int key="connectionID">5605</int>
</object>
<object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">tableRenameSheet</string>
- <reference key="source" ref="438574515"/>
- <reference key="destination" ref="399092485"/>
- </object>
- <int key="connectionID">5685</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">tableRenameText</string>
- <reference key="source" ref="438574515"/>
- <reference key="destination" ref="731300775"/>
- </object>
- <int key="connectionID">5686</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">closeSheet:</string>
- <reference key="source" ref="438574515"/>
- <reference key="destination" ref="88145988"/>
- </object>
- <int key="connectionID">5691</int>
- </object>
- <object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">closeSheet:</string>
<reference key="source" ref="438574515"/>
@@ -13005,30 +12881,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<int key="connectionID">5692</int>
</object>
<object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">closeSheet:</string>
- <reference key="source" ref="438574515"/>
- <reference key="destination" ref="994798282"/>
- </object>
- <int key="connectionID">5693</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">delegate</string>
- <reference key="source" ref="272856728"/>
- <reference key="destination" ref="438574515"/>
- </object>
- <int key="connectionID">5694</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">tableRenameField</string>
- <reference key="source" ref="438574515"/>
- <reference key="destination" ref="272856728"/>
- </object>
- <int key="connectionID">5697</int>
- </object>
- <object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">tableNameField</string>
<reference key="source" ref="438574515"/>
@@ -13762,14 +13614,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
- <string key="label">renameTableButton</string>
- <reference key="source" ref="438574515"/>
- <reference key="destination" ref="994798282"/>
- </object>
- <int key="connectionID">6206</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
<string key="label">databaseDataInstance</string>
<reference key="source" ref="438574515"/>
<reference key="destination" ref="631714493"/>
@@ -19025,84 +18869,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<reference key="parent" ref="81525228"/>
</object>
<object class="IBObjectRecord">
- <int key="objectID">5675</int>
- <reference key="object" ref="399092485"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="44272488"/>
- </object>
- <reference key="parent" ref="0"/>
- <string key="objectName">Rename Table Sheet</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">5676</int>
- <reference key="object" ref="44272488"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="994798282"/>
- <reference ref="731300775"/>
- <reference ref="272856728"/>
- <reference ref="88145988"/>
- </object>
- <reference key="parent" ref="399092485"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">5677</int>
- <reference key="object" ref="88145988"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="875831639"/>
- </object>
- <reference key="parent" ref="44272488"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">5678</int>
- <reference key="object" ref="272856728"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="859957158"/>
- </object>
- <reference key="parent" ref="44272488"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">5679</int>
- <reference key="object" ref="731300775"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="487237473"/>
- </object>
- <reference key="parent" ref="44272488"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">5680</int>
- <reference key="object" ref="994798282"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="825486974"/>
- </object>
- <reference key="parent" ref="44272488"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">5681</int>
- <reference key="object" ref="825486974"/>
- <reference key="parent" ref="994798282"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">5682</int>
- <reference key="object" ref="487237473"/>
- <reference key="parent" ref="731300775"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">5683</int>
- <reference key="object" ref="859957158"/>
- <reference key="parent" ref="272856728"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">5684</int>
- <reference key="object" ref="875831639"/>
- <reference key="parent" ref="88145988"/>
- </object>
- <object class="IBObjectRecord">
<int key="objectID">5701</int>
<reference key="object" ref="799840790"/>
<object class="NSMutableArray" key="children">
@@ -21862,28 +21628,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>5658.IBPluginDependency</string>
<string>5659.IBPluginDependency</string>
<string>5660.IBPluginDependency</string>
- <string>5675.IBEditorWindowLastContentRect</string>
- <string>5675.IBPluginDependency</string>
- <string>5675.IBWindowTemplateEditedContentRect</string>
- <string>5675.ImportedFromIB2</string>
- <string>5675.windowTemplate.hasMaxSize</string>
- <string>5675.windowTemplate.hasMinSize</string>
- <string>5675.windowTemplate.maxSize</string>
- <string>5675.windowTemplate.minSize</string>
- <string>5676.IBPluginDependency</string>
- <string>5676.ImportedFromIB2</string>
- <string>5677.IBPluginDependency</string>
- <string>5677.ImportedFromIB2</string>
- <string>5678.IBPluginDependency</string>
- <string>5678.ImportedFromIB2</string>
- <string>5679.IBPluginDependency</string>
- <string>5679.ImportedFromIB2</string>
- <string>5680.IBPluginDependency</string>
- <string>5680.ImportedFromIB2</string>
- <string>5681.IBPluginDependency</string>
- <string>5682.IBPluginDependency</string>
- <string>5683.IBPluginDependency</string>
- <string>5684.IBPluginDependency</string>
<string>5701.IBPluginDependency</string>
<string>5701.ImportedFromIB2</string>
<string>5702.IBPluginDependency</string>
@@ -23544,28 +23288,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{654, 442}, {260, 112}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{654, 442}, {260, 112}}</string>
- <integer value="1"/>
- <boolean value="YES"/>
- <integer value="1"/>
- <string>{600, 112}</string>
- <string>{260, 112}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -24258,14 +23980,12 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>mySQLConnection</string>
- <string>tableData</string>
<string>tableInstance</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
- <string>id</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@@ -24314,7 +24034,9 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<bool key="EncodedWithXMLCoder">YES</bool>
<string>chooseQueryFavorite:</string>
<string>chooseQueryHistory:</string>
+ <string>clearQueryHistory:</string>
<string>closeSheet:</string>
+ <string>copyQueryHistory:</string>
<string>filterQueryFavorites:</string>
<string>filterQueryHistory:</string>
<string>gearMenuItemSelected:</string>
@@ -24327,6 +24049,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>helpTargetDispatcher:</string>
<string>runAllQueries:</string>
<string>runSelectedQueries:</string>
+ <string>saveQueryHistory:</string>
<string>showAutoHelpForCurrentWord:</string>
<string>showHelpForCurrentWord:</string>
<string>showHelpForSearchString:</string>
@@ -24351,6 +24074,9 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>id</string>
<string>id</string>
<string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
@@ -24366,8 +24092,11 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>commentCurrentQueryMenuItem</string>
<string>commentLineOrSelectionMenuItem</string>
<string>completionListMenuItem</string>
+ <string>copyHistoryMenuItem</string>
+ <string>customQueryScrollView</string>
<string>customQueryView</string>
<string>editorFontMenuItem</string>
+ <string>encodingPopUp</string>
<string>errorText</string>
<string>helpNavigator</string>
<string>helpSearchField</string>
@@ -24392,6 +24121,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>runAllMenuItem</string>
<string>runSelectionButton</string>
<string>runSelectionMenuItem</string>
+ <string>saveHistoryMenuItem</string>
<string>saveQueryFavoriteButton</string>
<string>saveQueryFavoriteGlobal</string>
<string>shiftLeftMenuItem</string>
@@ -24413,8 +24143,11 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>NSMenuItem</string>
<string>NSMenuItem</string>
<string>NSMenuItem</string>
+ <string>NSMenuItem</string>
+ <string>NSScrollView</string>
<string>CMCopyTable</string>
<string>NSMenuItem</string>
+ <string>NSPopUpButton</string>
<string>id</string>
<string>NSSegmentedControl</string>
<string>NSSearchField</string>
@@ -24439,6 +24172,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>NSMenuItem</string>
<string>id</string>
<string>NSMenuItem</string>
+ <string>NSMenuItem</string>
<string>NSButton</string>
<string>id</string>
<string>NSMenuItem</string>
@@ -25080,7 +24814,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>NSView</string>
<string>id</string>
<string>id</string>
- <string>id</string>
+ <string>NSPopUpButton</string>
<string>id</string>
<string>id</string>
<string>id</string>
@@ -25743,173 +25477,76 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
</object>
</object>
- <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.1+">
+ <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
- <string key="className">CustomQuery</string>
- <string key="superclassName">NSObject</string>
- <object class="NSMutableDictionary" key="actions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>chooseQueryFavorite:</string>
- <string>chooseQueryHistory:</string>
- <string>clearQueryHistory:</string>
- <string>closeSheet:</string>
- <string>copyQueryHistory:</string>
- <string>filterQueryFavorites:</string>
- <string>filterQueryHistory:</string>
- <string>gearMenuItemSelected:</string>
- <string>helpSearchFindNextInPage:</string>
- <string>helpSearchFindPreviousInPage:</string>
- <string>helpSegmentDispatcher:</string>
- <string>helpSelectHelpTargetMySQL:</string>
- <string>helpSelectHelpTargetPage:</string>
- <string>helpSelectHelpTargetWeb:</string>
- <string>helpTargetDispatcher:</string>
- <string>runAllQueries:</string>
- <string>runSelectedQueries:</string>
- <string>saveQueryHistory:</string>
- <string>showAutoHelpForCurrentWord:</string>
- <string>showHelpForCurrentWord:</string>
- <string>showHelpForSearchString:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- </object>
+ <string key="className">BWAnchoredButton</string>
+ <string key="superclassName">NSButton</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">BWToolkitFramework.framework/Headers/BWAnchoredButton.h</string>
</object>
- <object class="NSMutableDictionary" key="outlets">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>affectedRowsText</string>
- <string>autohelpMenuItem</string>
- <string>autoindentMenuItem</string>
- <string>autopairMenuItem</string>
- <string>autouppercaseKeywordsMenuItem</string>
- <string>clearHistoryMenuItem</string>
- <string>commentCurrentQueryMenuItem</string>
- <string>commentLineOrSelectionMenuItem</string>
- <string>completionListMenuItem</string>
- <string>copyHistoryMenuItem</string>
- <string>customQueryScrollView</string>
- <string>customQueryView</string>
- <string>editorFontMenuItem</string>
- <string>errorText</string>
- <string>helpNavigator</string>
- <string>helpSearchField</string>
- <string>helpSearchFieldCell</string>
- <string>helpTargetSelector</string>
- <string>helpWebView</string>
- <string>helpWebViewWindow</string>
- <string>multipleLineEditingButton</string>
- <string>queryFavoriteNameTextField</string>
- <string>queryFavoritesButton</string>
- <string>queryFavoritesSaveAllMenuItem</string>
- <string>queryFavoritesSaveAsMenuItem</string>
- <string>queryFavoritesSearchField</string>
- <string>queryFavoritesSearchFieldView</string>
- <string>queryFavoritesSearchMenuItem</string>
- <string>queryFavoritesSheet</string>
- <string>queryHistoryButton</string>
- <string>queryHistorySearchField</string>
- <string>queryHistorySearchFieldView</string>
- <string>queryHistorySearchMenuItem</string>
- <string>runAllButton</string>
- <string>runAllMenuItem</string>
- <string>runSelectionButton</string>
- <string>runSelectionMenuItem</string>
- <string>saveHistoryMenuItem</string>
- <string>saveQueryFavoriteButton</string>
- <string>saveQueryFavoriteGlobal</string>
- <string>shiftLeftMenuItem</string>
- <string>shiftRightMenuItem</string>
- <string>tableDocumentInstance</string>
- <string>tableWindow</string>
- <string>textView</string>
- <string>valueSheet</string>
- <string>valueTextField</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>NSMenuItem</string>
- <string>NSMenuItem</string>
- <string>NSMenuItem</string>
- <string>NSMenuItem</string>
- <string>NSMenuItem</string>
- <string>NSMenuItem</string>
- <string>NSMenuItem</string>
- <string>NSMenuItem</string>
- <string>NSMenuItem</string>
- <string>NSScrollView</string>
- <string>CMCopyTable</string>
- <string>NSMenuItem</string>
- <string>id</string>
- <string>NSSegmentedControl</string>
- <string>NSSearchField</string>
- <string>NSSearchFieldCell</string>
- <string>NSSegmentedControl</string>
- <string>WebView</string>
- <string>NSWindow</string>
- <string>id</string>
- <string>NSTextField</string>
- <string>id</string>
- <string>NSMenuItem</string>
- <string>NSMenuItem</string>
- <string>NSSearchField</string>
- <string>id</string>
- <string>NSMenuItem</string>
- <string>NSWindow</string>
- <string>id</string>
- <string>NSSearchField</string>
- <string>id</string>
- <string>NSMenuItem</string>
- <string>id</string>
- <string>NSMenuItem</string>
- <string>id</string>
- <string>NSMenuItem</string>
- <string>NSMenuItem</string>
- <string>NSButton</string>
- <string>id</string>
- <string>NSMenuItem</string>
- <string>NSMenuItem</string>
- <string>id</string>
- <string>id</string>
- <string>CMTextView</string>
- <string>id</string>
- <string>id</string>
- </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">BWAnchoredButtonBar</string>
+ <string key="superclassName">NSView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">BWToolkitFramework.framework/Headers/BWAnchoredButtonBar.h</string>
</object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">BWAnchoredButtonCell</string>
+ <string key="superclassName">NSButtonCell</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBDocumentRelativeSource</string>
- <string key="minorKey">../../Source/CustomQuery.h</string>
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">BWToolkitFramework.framework/Headers/BWAnchoredButtonCell.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">BWAnchoredPopUpButton</string>
+ <string key="superclassName">NSPopUpButton</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">BWToolkitFramework.framework/Headers/BWAnchoredPopUpButton.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">BWAnchoredPopUpButtonCell</string>
+ <string key="superclassName">NSPopUpButtonCell</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">BWToolkitFramework.framework/Headers/BWAnchoredPopUpButtonCell.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">BWGradientBox</string>
+ <string key="superclassName">NSView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">BWToolkitFramework.framework/Headers/BWGradientBox.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">BWInsetTextField</string>
+ <string key="superclassName">NSTextField</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">BWToolkitFramework.framework/Headers/BWInsetTextField.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">BWSplitView</string>
+ <string key="superclassName">NSSplitView</string>
+ <object class="NSMutableDictionary" key="actions">
+ <string key="NS.key.0">toggleCollapse:</string>
+ <string key="NS.object.0">id</string>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">BWToolkitFramework.framework/Headers/BWSplitView.h</string>
</object>
</object>
- </object>
- <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
- <bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">NSActionCell</string>
<string key="superclassName">NSCell</string>
@@ -25962,6 +25599,13 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">NSApplication</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">BWToolkitFramework.framework/Headers/NSApplication+BWAdditions.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">NSBox</string>
<string key="superclassName">NSView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@@ -26715,6 +26359,13 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<reference key="sourceIdentifier" ref="559681503"/>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">NSView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">BWToolkitFramework.framework/Headers/NSView+BWAdditions.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">NSWindow</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
@@ -26737,6 +26388,13 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">NSWindow</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">BWToolkitFramework.framework/Headers/NSWindow+BWAdditions.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">NSWindowController</string>
<string key="superclassName">NSResponder</string>
<object class="NSMutableDictionary" key="actions">
diff --git a/Source/TablesList.h b/Source/TablesList.h
index 1318108b..b64e0de0 100644
--- a/Source/TablesList.h
+++ b/Source/TablesList.h
@@ -73,10 +73,6 @@ enum sp_table_types
IBOutlet id toolbarActionsButton;
IBOutlet id toolbarReloadButton;
IBOutlet id addTableButton;
- IBOutlet id tableRenameSheet;
- IBOutlet id tableRenameField;
- IBOutlet id tableRenameText;
- IBOutlet id renameTableButton;
IBOutlet id truncateTableButton;
IBOutlet id truncateTableContextButton;
IBOutlet NSSplitView *tableListSplitView;
diff --git a/Source/TablesList.m b/Source/TablesList.m
index 31cbd599..cff345fc 100644
--- a/Source/TablesList.m
+++ b/Source/TablesList.m
@@ -45,10 +45,9 @@
- (void)truncateTable;
- (void)addTable;
- (void)copyTable;
-- (void)renameTable;
-- (void)renameTableFrom:(NSString *)oldTableName To:(NSString *)newTableName;
-- (BOOL)isTableNameValid:(NSString *)tableName;
-- (BOOL)isTableNameValid:(NSString *)tableName ignoringSelectedTable:(BOOL)ignoreSelectedTable;
+- (void)renameTableOfType: (enum sp_table_types)tableType from:(NSString *)oldTableName to:(NSString *)newTableName;
+- (BOOL)isTableNameValid:(NSString *)tableName forType: (enum sp_table_types)tableType;
+- (BOOL)isTableNameValid:(NSString *)tableName forType: (enum sp_table_types)tableType ignoringSelectedTable:(BOOL)ignoreSelectedTable;
@end
@@ -417,7 +416,7 @@
}
/**
- * Renames the currently selected table.
+ * This action starts editing the table name in the table list
*/
- (IBAction)renameTable:(id)sender
{
@@ -426,7 +425,15 @@
}
[tableWindow endEditingFor:nil];
- [tableRenameField setStringValue:[self tableName]];
+
+ if ([tablesListView numberOfSelectedRows] != 1) return;
+ if (![[self tableName] length]) return;
+
+ [tablesListView editColumn:0 row:[tablesListView selectedRow] withEvent:nil select:YES];
+
+ /*
+
+ [tableRenameField setStringValue:[self tableName]];
[renameTableButton setEnabled:NO];
NSString *tableType;
@@ -448,11 +455,13 @@
[tableRenameText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Rename %@ '%@' to:",@"rename item name to:"), tableType, [self tableName]]];
+
[NSApp beginSheet:tableRenameSheet
modalForWindow:tableWindow
modalDelegate:self
didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
contextInfo:@"renameTable"];
+ */
}
/**
@@ -539,11 +548,6 @@
[self copyTable];
}
}
- else if ([contextInfo isEqualToString:@"renameTable"]) {
- if (returnCode == NSOKButton) {
- [self renameTable];
- }
- }
}
#pragma mark -
@@ -572,21 +576,15 @@
*/
- (void)controlTextDidChange:(NSNotification *)notification
{
-
id object = [notification object];
if (object == tableNameField) {
- [addTableButton setEnabled:[self isTableNameValid:[tableNameField stringValue]]];
+ [addTableButton setEnabled:[self isTableNameValid:[tableNameField stringValue] forType: SP_TABLETYPE_TABLE]];
}
else if (object == copyTableNameField) {
- [copyTableButton setEnabled:[self isTableNameValid:[copyTableNameField stringValue]]];
- }
-
- else if (object == tableRenameField) {
- [renameTableButton setEnabled:[self isTableNameValid:[tableRenameField stringValue] ignoringSelectedTable:YES]];
+ [copyTableButton setEnabled:[self isTableNameValid:[copyTableNameField stringValue] forType:[self tableType]]];
}
-
}
/*
@@ -601,10 +599,7 @@
if([[[notification userInfo] objectForKey:@"NSTextMovement"] integerValue] != 0)
return;
- if (object == tableRenameField) {
- [renameTableButton performClick:object];
- }
- else if (object == tableNameField) {
+ if (object == tableNameField) {
[addTableButton performClick:object];
}
else if (object == copyTableNameField) {
@@ -1219,67 +1214,76 @@
*/
- (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
- if ([selectedTableName isEqualToString:anObject]) {
+ //first trim whitespace whitespace
+ NSString *newTableName = [anObject stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
+
+ if ([selectedTableName isEqualToString:newTableName]) {
// No changes in table name
return;
}
- if ([anObject isEqualToString:@""]) {
- // Table has no name
- alertSheetOpened = YES;
+ if ([newTableName isEqualToString:@""]) {
+ // empty table names are not allowed
+ // don't annoy the user about it, just ignore this
+ // this is also how the MacOS Finder handles renaming files
+ return;
+ }
+
+ if (![self isTableNameValid:newTableName forType:selectedTableType ignoringSelectedTable:YES]) {
+ // Table has invalid name
+ // Since we trimmed whitespace and checked for empty string, this means there is already a table with that name
SPBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self,
- @selector(sheetDidEnd:returnCode:contextInfo:), nil, @"addRow", NSLocalizedString(@"Empty names are not allowed.", @"message of panel when no name is given for an item"));
+ @selector(sheetDidEnd:returnCode:contextInfo:), nil, nil,
+ [NSString stringWithFormat: NSLocalizedString(@"The name '%@' is already used.", @"message when trying to rename a table/view/proc/etc to an already used name"), newTableName]);
return;
- }
+ }
+
@try {
- [self renameTableFrom:[self tableName] To:anObject];
+ // first: update the database
+ [self renameTableOfType:selectedTableType from:selectedTableName to:newTableName];
- // Renamed with success
+ // second: update the table list
if (isTableListFiltered) {
NSInteger unfilteredIndex = [tables indexOfObject:[filteredTables objectAtIndex:rowIndex]];
- [tables replaceObjectAtIndex:unfilteredIndex withObject:anObject];
+ [tables replaceObjectAtIndex:unfilteredIndex withObject:newTableName];
}
- [filteredTables replaceObjectAtIndex:rowIndex withObject:anObject];
+ [filteredTables replaceObjectAtIndex:rowIndex withObject:newTableName];
if (selectedTableName) [selectedTableName release];
- selectedTableName = [[NSString alloc] initWithString:anObject];
-
- if(selectedTableType == SP_TABLETYPE_FUNC || selectedTableType == SP_TABLETYPE_PROC)
- return;
- NSInteger selectedIndex = [tabView indexOfTabViewItem:[tabView selectedTabViewItem]];
+ selectedTableName = [[NSString alloc] initWithString:newTableName];
- if (selectedIndex == 0) {
- [tableSourceInstance loadTable:anObject];
- structureLoaded = YES;
- contentLoaded = NO;
- statusLoaded = NO;
- }
- else if (selectedIndex == 1) {
- [tableContentInstance loadTable:anObject];
- structureLoaded = NO;
- contentLoaded = YES;
- statusLoaded = NO;
- }
- else if (selectedIndex == 3) {
- [extendedTableInfoInstance loadTable:anObject];
- structureLoaded = NO;
- contentLoaded = NO;
- statusLoaded = YES;
- }
- else {
- statusLoaded = NO;
- structureLoaded = NO;
- contentLoaded = NO;
+ // if the 'table' is a view or a table, reload the currently selected view
+ if (selectedTableType == SP_TABLETYPE_TABLE || selectedTableType == SP_TABLETYPE_VIEW)
+ {
+ switch ([tabView indexOfTabViewItem:[tabView selectedTabViewItem]]) {
+ case 0:
+ [tableSourceInstance loadTable:newTableName];
+ structureLoaded = YES;
+ contentLoaded = statusLoaded = NO;
+ break;
+ case 1:
+ [tableContentInstance loadTable:newTableName];
+ contentLoaded = YES;
+ structureLoaded = statusLoaded = NO;
+ break;
+ case 3:
+ [extendedTableInfoInstance loadTable:newTableName];
+ statusLoaded = YES;
+ structureLoaded = contentLoaded = NO;
+ break;
+ default:
+ statusLoaded = structureLoaded = contentLoaded = NO;
+ }
}
-
- // Set window title
- [tableWindow setTitle:[tableDocumentInstance displaySPName]];
-
- // Query the structure of all databases in the background (mainly for completion)
- [NSThread detachNewThreadSelector:@selector(queryDbStructure) toTarget:mySQLConnection withObject:nil];
}
@catch (NSException * myException) {
- SPBeginAlertSheet( NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, myException.reason);
+ SPBeginAlertSheet( NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, [myException reason]);
}
+
+ // Set window title to reflect the new table name
+ [tableWindow setTitle:[tableDocumentInstance displaySPName]];
+
+ // Query the structure of all databases in the background (mainly for completion)
+ [NSThread detachNewThreadSelector:@selector(queryDbStructure) toTarget:mySQLConnection withObject:nil];
}
#pragma mark -
@@ -2125,43 +2129,12 @@
}
}
-/**
- * Renames the currently selected object (table, view, procedure, function, etc.).
- */
-- (void)renameTable
-{
- // if the table name didn't change, do nothing
- if ([[tableRenameField stringValue] isEqualToString:[self tableName]]) return;
-
- @try {
- [self renameTableFrom:[self tableName] To:[tableRenameField stringValue]];
-
- //rename the table in our list and reload the table view's data
- if (isTableListFiltered) {
- [tables replaceObjectAtIndex:[tables indexOfObject:[self tableName]] withObject:[tableRenameField stringValue]];
- }
- [filteredTables replaceObjectAtIndex:[tablesListView selectedRow] withObject:[tableRenameField stringValue]];
- if (selectedTableName) [selectedTableName release];
- selectedTableName = [[NSString alloc] initWithString:[tableRenameField stringValue]];
- [tablesListView reloadData];
- [self updateSelectionWithTaskString:[NSString stringWithFormat:NSLocalizedString(@"Loading %@...", @"Loading table task string"), selectedTableName]];
-
- // Query the structure of all databases in the background (mainly for completion)
- [NSThread detachNewThreadSelector:@selector(queryDbStructure) toTarget:mySQLConnection withObject:nil];
- }
- @catch (NSException * myException) {
- SPBeginAlertSheet( NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, myException.reason);
- }
-
- // Set window title
- [tableWindow setTitle:[tableDocumentInstance displaySPName]];
-}
-
/*
* Renames a table, view, procedure or function. Also handles only changes in case!
+ * This function ONLY changes the database. It does NOT refresh the views etc.
* CAREFUL: This function raises an exception if renaming fails, and does not show an error message.
*/
-- (void)renameTableFrom:(NSString *)oldTableName To:(NSString *)newTableName;
+- (void)renameTableOfType: (enum sp_table_types)tableType from:(NSString *)oldTableName to:(NSString *)newTableName
{
// check if the name really changed
if ([oldTableName isEqualToString:newTableName]) return;
@@ -2175,20 +2148,20 @@
int tempNumber;
for(tempNumber=2; tempNumber<100; tempNumber++) {
tempTableName = [NSString stringWithFormat:@"%@-%d",selectedTableName,tempNumber];
- if ([self isTableNameValid:tempTableName]) break;
+ if ([self isTableNameValid:tempTableName forType:tableType]) break;
}
if (tempNumber==100) {
// we couldn't find a temporary name
[NSException raise:@"No Tempname found" format:NSLocalizedString(@"An error occured while renaming '%@'. No temporary name could be found. Please try renaming to something else first.", @"rename table error - no temporary name found"), oldTableName];
}
- [self renameTableFrom:oldTableName To:tempTableName];
- [self renameTableFrom:tempTableName To:newTableName];
+ [self renameTableOfType:tableType from:oldTableName to:tempTableName];
+ [self renameTableOfType:tableType from:tempTableName to:newTableName];
return;
}
//check if we are trying to rename a TABLE or a VIEW
- if (selectedTableType == SP_TABLETYPE_VIEW || selectedTableType == SP_TABLETYPE_TABLE) {
+ if (tableType == SP_TABLETYPE_VIEW || tableType == SP_TABLETYPE_TABLE) {
// we can use the rename table statement
[mySQLConnection queryString:[NSString stringWithFormat:@"RENAME TABLE %@ TO %@", [oldTableName backtickQuotedString], [newTableName backtickQuotedString]]];
// check for errors
@@ -2199,17 +2172,17 @@
}
//check if we are trying to rename a PROCEDURE or a FUNCTION
- if (selectedTableType == SP_TABLETYPE_PROC || selectedTableType == SP_TABLETYPE_FUNC) {
+ if (tableType == SP_TABLETYPE_PROC || tableType == SP_TABLETYPE_FUNC) {
// procedures and functions can only be renamed if one creates a new one and deletes the old one
// first get the create syntax
- NSString *tableType;
- switch (selectedTableType){
- case SP_TABLETYPE_PROC: tableType = @"PROCEDURE"; break;
- case SP_TABLETYPE_FUNC: tableType = @"FUNCTION"; break;
+ NSString *stringTableType;
+ switch (tableType){
+ case SP_TABLETYPE_PROC: stringTableType = @"PROCEDURE"; break;
+ case SP_TABLETYPE_FUNC: stringTableType = @"FUNCTION"; break;
}
- MCPResult *theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW CREATE %@ %@", tableType, [oldTableName backtickQuotedString] ] ];
+ MCPResult *theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW CREATE %@ %@", stringTableType, [oldTableName backtickQuotedString] ] ];
if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
[NSException raise:@"MySQL Error" format:NSLocalizedString(@"An error occured while renaming. I couldn't retrieve the syntax for '%@'.\n\nMySQL said: %@", @"rename precedure/function error - can't retrieve syntax"), oldTableName, [mySQLConnection getLastErrorMessage]];
}
@@ -2217,14 +2190,18 @@
NSString *oldCreateSyntax = [[theResult fetchRowAsArray] objectAtIndex:2];
// replace the old name with the new name
- NSString *newCreateSyntax = [oldCreateSyntax stringByReplacingCharactersInRange:[oldCreateSyntax rangeOfString: [NSString stringWithFormat:@"%@ %@", tableType, [oldTableName backtickQuotedString] ] ]
- withString:[NSString stringWithFormat:@"%@ %@", tableType, [newTableName backtickQuotedString] ] ];
+ NSRange rangeOfProcedureName = [oldCreateSyntax rangeOfString: [NSString stringWithFormat:@"%@ %@", stringTableType, [oldTableName backtickQuotedString] ] ];
+ if (rangeOfProcedureName.length == 0) {
+ [NSException raise:@"Unknown Syntax" format:NSLocalizedString(@"An error occured while renaming. The CREATE syntax of '%@' could not be parsed.", @"rename error - invalid create syntax"), oldTableName];
+ }
+ NSString *newCreateSyntax = [oldCreateSyntax stringByReplacingCharactersInRange: rangeOfProcedureName
+ withString: [NSString stringWithFormat:@"%@ %@", stringTableType, [newTableName backtickQuotedString] ] ];
[mySQLConnection queryString: newCreateSyntax];
if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
[NSException raise:@"MySQL Error" format:NSLocalizedString(@"An error occured while renaming. I couldn't recreate '%@'.\n\nMySQL said: %@", @"rename precedure/function error - can't recreate procedure"), oldTableName, [mySQLConnection getLastErrorMessage]];
}
- [mySQLConnection queryString: [NSString stringWithFormat: @"DROP %@ %@", tableType, [oldTableName backtickQuotedString]]];
+ [mySQLConnection queryString: [NSString stringWithFormat: @"DROP %@ %@", stringTableType, [oldTableName backtickQuotedString]]];
if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
[NSException raise:@"MySQL Error" format:NSLocalizedString(@"An error occured while renaming. I couldn't remove '%@'.\n\nMySQL said: %@", @"rename precedure/function error - can't remove old procedure"), oldTableName, [mySQLConnection getLastErrorMessage]];
}
@@ -2240,11 +2217,12 @@
* Check tableName for length and if the tableName doesn't match
* against current database table/view names (case-insensitive).
*/
-- (BOOL)isTableNameValid:(NSString *)tableName
+- (BOOL)isTableNameValid:(NSString *)tableName forType: (enum sp_table_types)tableType
{
- return [self isTableNameValid:tableName ignoringSelectedTable:NO];
+ return [self isTableNameValid:tableName forType:tableType ignoringSelectedTable:NO];
}
-- (BOOL)isTableNameValid:(NSString *)tableName ignoringSelectedTable:(BOOL)ignoreSelectedTable
+
+- (BOOL)isTableNameValid:(NSString *)tableName forType: (enum sp_table_types)tableType ignoringSelectedTable:(BOOL)ignoreSelectedTable
{
BOOL isValid = YES;
@@ -2259,7 +2237,25 @@
if([fieldStr length] == 0) return NO;
- for(id table in [self allTableAndViewNames]) {
+ NSArray *similarTables;
+ switch (tableType) {
+ case SP_TABLETYPE_VIEW:
+ case SP_TABLETYPE_TABLE:
+ similarTables = [self allTableAndViewNames];
+ break;
+ case SP_TABLETYPE_PROC:
+ similarTables = [self allProcedureNames];
+ break;
+ case SP_TABLETYPE_FUNC:
+ similarTables = [self allFunctionNames];
+ break;
+ default:
+ // if some other table type is given, just return yes
+ // better a mysql error than not being able to change something at all
+ return YES;
+ }
+
+ for(id table in similarTables) {
//compare case insensitive here
if([lowercaseFieldStr isEqualToString:[table lowercaseString]]) {
if (ignoreSelectedTable) {