aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TablesList.m
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 /Source/TablesList.m
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 )
Diffstat (limited to 'Source/TablesList.m')
-rw-r--r--Source/TablesList.m13
1 files changed, 10 insertions, 3 deletions
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;