aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TableSource.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-02-03 10:34:33 +0000
committerBibiko <bibiko@eva.mpg.de>2010-02-03 10:34:33 +0000
commitc9e9a6a1c8d8c9d0e40a45a2ce2d5d95cf1dafba (patch)
tree271313021ba56cbb86357da56d6158cf43509129 /Source/TableSource.m
parent4fe58d39c65438f13398a3617f06e2077840a176 (diff)
downloadsequelpro-c9e9a6a1c8d8c9d0e40a45a2ce2d5d95cf1dafba.tar.gz
sequelpro-c9e9a6a1c8d8c9d0e40a45a2ce2d5d95cf1dafba.tar.bz2
sequelpro-c9e9a6a1c8d8c9d0e40a45a2ce2d5d95cf1dafba.zip
• field mapping sheet is now document-modal instead of blocking SP entirely
• if an error occurred while retrieving column or index data in Structure pane reset Structure pane to a stable status, display the error message, and reload Tables List table due to the fact the it's very likely that SP tries to retrieve data from a table which doesn't exist anymore • fixed spelling of "occurred" Note: NOT YET DONE: if in Structure view the actual underlying table was deleted or renamed by an other mysql event and the user tries to add/change a field do suppress this attempt safely
Diffstat (limited to 'Source/TableSource.m')
-rw-r--r--Source/TableSource.m42
1 files changed, 42 insertions, 0 deletions
diff --git a/Source/TableSource.m b/Source/TableSource.m
index 1aa6185e..819bdea7 100644
--- a/Source/TableSource.m
+++ b/Source/TableSource.m
@@ -99,6 +99,27 @@ loads aTable, put it in an array, update the tableViewColumns and reload the tab
//perform queries and load results in array (each row as a dictionary)
tableSourceResult = [[mySQLConnection queryString:[NSString stringWithFormat:@"SHOW COLUMNS FROM %@", [selectedTable backtickQuotedString]]] retain];
+ if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
+ NSString *errorMessage = [NSString stringWithString:[mySQLConnection getLastErrorMessage]];
+ [tableFields removeAllObjects];
+ [indexes removeAllObjects];
+ [tableSourceView reloadData];
+ [tablesListInstance updateTables:self];
+ [indexView reloadData];
+ [addFieldButton setEnabled:NO];
+ [copyFieldButton setEnabled:NO];
+ [removeFieldButton setEnabled:NO];
+ [addIndexButton setEnabled:NO];
+ [removeIndexButton setEnabled:NO];
+ [editTableButton setEnabled:NO];
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
+ SPBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"),
+ nil, nil, [NSApp mainWindow], self, nil, nil, nil,
+ [NSString stringWithFormat:NSLocalizedString(@"An error occurred while retrieving information.\nMySQL said: %@", @"message of panel when retrieving information failed"),
+ errorMessage]);
+ return;
+ }
+
[tableSourceResult setReturnDataAsStrings:YES];
// listFieldsFromTable is broken in the current version of the framework (no back-ticks for table name)!
@@ -108,6 +129,27 @@ loads aTable, put it in an array, update the tableViewColumns and reload the tab
[tableSourceResult release];
indexResult = [[mySQLConnection queryString:[NSString stringWithFormat:@"SHOW INDEX FROM %@", [selectedTable backtickQuotedString]]] retain];
+ if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
+ NSString *errorMessage = [NSString stringWithString:[mySQLConnection getLastErrorMessage]];
+ [tableFields removeAllObjects];
+ [indexes removeAllObjects];
+ [tableSourceView reloadData];
+ [tablesListInstance updateTables:self];
+ [indexView reloadData];
+ [addFieldButton setEnabled:NO];
+ [copyFieldButton setEnabled:NO];
+ [removeFieldButton setEnabled:NO];
+ [addIndexButton setEnabled:NO];
+ [removeIndexButton setEnabled:NO];
+ [editTableButton setEnabled:NO];
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
+ SPBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"),
+ nil, nil, [NSApp mainWindow], self, nil, nil, nil,
+ [NSString stringWithFormat:NSLocalizedString(@"An error occurred while retrieving information.\nMySQL said: %@", @"message of panel when retrieving information failed"),
+ errorMessage]);
+
+ return;
+ }
[indexResult setReturnDataAsStrings:YES];
// [indexes setArray:[[self fetchResultAsArray:indexResult] retain]];
[indexes setArray:[self fetchResultAsArray:indexResult]];