aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-06-10 13:14:43 +0000
committerBibiko <bibiko@eva.mpg.de>2009-06-10 13:14:43 +0000
commit910d3dcf2fcea97d445b94ba902f8a0b8279916e (patch)
treecef06756825969ef0c24e8c04af52473c25991ca
parent65ad99e8fdbce63bcf65151d5f77403683959349 (diff)
downloadsequelpro-910d3dcf2fcea97d445b94ba902f8a0b8279916e.tar.gz
sequelpro-910d3dcf2fcea97d445b94ba902f8a0b8279916e.tar.bz2
sequelpro-910d3dcf2fcea97d445b94ba902f8a0b8279916e.zip
• cleaned code for the case that the user selects a view which causes a MySQL error while retrieving data
- [SPTableData tableEncoding] returns nil if no encoding can be found - [TableList tableViewSelectionDidChange:] checks in beforehand for a valid table encoding; this avoids to get the same MySQL error message twice and cleaned the structure view • if a MySQL error occurred while retrieving table data for the content view set the content view to a defined and clean status • bound TableContent's filterButton to DBView.xib to disable it if an error occurred (otherwise the status bar shows unexplainable results )
-rw-r--r--Interfaces/English.lproj/DBView.xib65
-rw-r--r--Source/SPTableData.m2
-rw-r--r--Source/TableContent.m5
-rw-r--r--Source/TablesList.m13
4 files changed, 38 insertions, 47 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib
index 0985a69e..425fa9e5 100644
--- a/Interfaces/English.lproj/DBView.xib
+++ b/Interfaces/English.lproj/DBView.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="4487"/>
+ <integer value="27"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -372,7 +372,7 @@
<reference key="NSControlView" ref="1029554648"/>
<int key="NSButtonFlags">-2042609409</int>
<int key="NSButtonFlags2">35</int>
- <object class="NSCustomResource" key="NSNormalImage">
+ <object class="NSCustomResource" key="NSNormalImage" id="738720219">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">button_action</string>
</object>
@@ -387,10 +387,7 @@
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
- <object class="NSCustomResource" key="NSImage" id="384286385">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">button_action</string>
- </object>
+ <reference key="NSImage" ref="738720219"/>
<string key="NSAction">_popUpItemAction:</string>
<reference key="NSTarget" ref="753352469"/>
</object>
@@ -1928,7 +1925,7 @@
<object class="NSTabViewItem" id="624106058">
<string key="NSIdentifier">content</string>
<object class="NSView" key="NSView" id="1013108064">
- <nil key="NSNextResponder"/>
+ <reference key="NSNextResponder" ref="714795046"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -2277,8 +2274,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>
@@ -2531,6 +2528,7 @@
</object>
</object>
<string key="NSFrame">{{10, 7}, {700, 544}}</string>
+ <reference key="NSSuperview" ref="714795046"/>
</object>
<string key="NSLabel">Content</string>
<reference key="NSColor" ref="62854682"/>
@@ -2539,7 +2537,7 @@
<object class="NSTabViewItem" id="105987292">
<string key="NSIdentifier">customQuery</string>
<object class="NSView" key="NSView" id="746504912">
- <reference key="NSNextResponder" ref="714795046"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -2566,29 +2564,6 @@
<object class="NSTextView" id="1055190999">
<reference key="NSNextResponder" ref="1072692119"/>
<int key="NSvFlags">6418</int>
- <object class="NSMutableSet" key="NSDragTypes">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMutableArray" key="set.sortedObjects">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>Apple HTML pasteboard type</string>
- <string>Apple PDF pasteboard type</string>
- <string>Apple PICT pasteboard type</string>
- <string>Apple PNG pasteboard type</string>
- <string>Apple URL pasteboard type</string>
- <string>CorePasteboardFlavorType 0x6D6F6F76</string>
- <string>CorePasteboardFlavorType 0x75726C20</string>
- <string>NSColor pasteboard type</string>
- <string>NSFilenamesPboardType</string>
- <string>NSStringPboardType</string>
- <string>NeXT Encapsulated PostScript v1.2 pasteboard type</string>
- <string>NeXT RTFD pasteboard type</string>
- <string>NeXT Rich Text Format v1.0 pasteboard type</string>
- <string>NeXT TIFF v4.0 pasteboard type</string>
- <string>NeXT font pasteboard type</string>
- <string>NeXT ruler pasteboard type</string>
- <string>WebURLsWithTitlesPboardType</string>
- </object>
- </object>
<string key="NSFrameSize">{688, 14}</string>
<reference key="NSSuperview" ref="1072692119"/>
<object class="NSTextContainer" key="NSTextContainer" id="326170846">
@@ -2964,7 +2939,7 @@
<reference key="NSControlView" ref="363916571"/>
<int key="NSButtonFlags">-2042609409</int>
<int key="NSButtonFlags2">35</int>
- <reference key="NSNormalImage" ref="384286385"/>
+ <reference key="NSNormalImage" ref="738720219"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">400</int>
@@ -2976,7 +2951,7 @@
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSImage" ref="384286385"/>
+ <reference key="NSImage" ref="738720219"/>
<string key="NSAction">_popUpItemAction:</string>
<reference key="NSTarget" ref="984501775"/>
</object>
@@ -3326,7 +3301,6 @@
</object>
</object>
<string key="NSFrame">{{10, 7}, {700, 544}}</string>
- <reference key="NSSuperview" ref="714795046"/>
</object>
<string key="NSLabel">Custom Query</string>
<reference key="NSColor" ref="62854682"/>
@@ -4392,14 +4366,14 @@
<reference key="NSTabView" ref="714795046"/>
</object>
</object>
- <reference key="NSSelectedTabViewItem" ref="105987292"/>
+ <reference key="NSSelectedTabViewItem" ref="624106058"/>
<reference key="NSFont" ref="26"/>
<int key="NSTvFlags">134217731</int>
<bool key="NSAllowTruncatedLabels">YES</bool>
<bool key="NSDrawsBackground">YES</bool>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="746504912"/>
+ <reference ref="1013108064"/>
</object>
</object>
</object>
@@ -7195,6 +7169,7 @@
<object class="NSMutableArray" key="set.sortedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>Apple HTML pasteboard type</string>
+ <string>Apple PDF pasteboard type</string>
<string>Apple PICT pasteboard type</string>
<string>Apple URL pasteboard type</string>
<string>Apple Web Archive pasteboard type</string>
@@ -15790,6 +15765,14 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<int key="connectionID">5941</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">filterButton</string>
+ <reference key="source" ref="392169872"/>
+ <reference key="destination" ref="983589239"/>
+ </object>
+ <int key="connectionID">5942</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -25032,8 +25015,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{114, 99}, {944, 550}}</string>
- <string>{{114, 99}, {944, 550}}</string>
+ <string>{{310, -112}, {944, 550}}</string>
+ <string>{{310, -112}, {944, 550}}</string>
<reference ref="9"/>
<reference ref="9"/>
<string>{{62, 352}, {845, 504}}</string>
@@ -25892,7 +25875,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">5941</int>
+ <int key="maxID">5942</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
diff --git a/Source/SPTableData.m b/Source/SPTableData.m
index 5657dd2c..a5e29a9d 100644
--- a/Source/SPTableData.m
+++ b/Source/SPTableData.m
@@ -75,7 +75,7 @@
[self updateInformationForCurrentTable];
}
}
- return [NSString stringWithString:tableEncoding];
+ return (tableEncoding == nil) ? nil : [NSString stringWithString:tableEncoding];
}
/*
diff --git a/Source/TableContent.m b/Source/TableContent.m
index 855c44ca..da8a9745 100644
--- a/Source/TableContent.m
+++ b/Source/TableContent.m
@@ -110,8 +110,9 @@
[tableContentView removeTableColumn:[theColumns objectAtIndex:0]];
}
- // If no table has been supplied, reset the view to a blank table and disabled elements
- if ( [aTable isEqualToString:@""] || !aTable )
+ // If no table has been supplied, reset the view to a blank table and disabled elements.
+ // [tableDataInstance tableEncoding] == nil indicates that an error occured while retrieving table data
+ if ( [aTable isEqualToString:@""] || !aTable || [tableDataInstance tableEncoding] == nil)
{
// Empty the stored data arrays
[fullResult removeAllObjects];
diff --git a/Source/TablesList.m b/Source/TablesList.m
index 2d8ad1dc..d90f7972 100644
--- a/Source/TablesList.m
+++ b/Source/TablesList.m
@@ -1106,11 +1106,14 @@
if( [[tableTypes objectAtIndex:[tablesListView selectedRow]] intValue] == SP_TABLETYPE_VIEW ||
[[tableTypes objectAtIndex:[tablesListView selectedRow]] intValue] == SP_TABLETYPE_TABLE) {
+
+ // tableEncoding == nil indicates that there was an error while retrieving table data
+ NSString *tableEncoding = [tableDataInstance tableEncoding];
// If encoding is set to Autodetect, update the connection character set encoding
// based on the newly selected table's encoding - but only if it differs from the current encoding.
if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"DefaultEncoding"] isEqualToString:@"Autodetect"]) {
- if (![[tableDataInstance tableEncoding] isEqualToString:[tableDocumentInstance connectionEncoding]]) {
- [tableDocumentInstance setConnectionEncoding:[tableDataInstance tableEncoding] reloadingViews:NO];
+ if (tableEncoding != nil && ![tableEncoding isEqualToString:[tableDocumentInstance connectionEncoding]]) {
+ [tableDocumentInstance setConnectionEncoding:tableEncoding reloadingViews:NO];
[tableDataInstance resetAllData];
}
}
@@ -1121,7 +1124,11 @@
contentLoaded = NO;
statusLoaded = NO;
} else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 1 ) {
- [tableContentInstance loadTable:[tables objectAtIndex:[tablesListView selectedRow]]];
+ if(tableEncoding == nil) {
+ [tableContentInstance loadTable:nil];
+ } else {
+ [tableContentInstance loadTable:[tables objectAtIndex:[tablesListView selectedRow]]];
+ }
structureLoaded = NO;
contentLoaded = YES;
statusLoaded = NO;