diff options
author | rowanbeentje <rowan@beent.je> | 2010-03-27 15:01:59 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2010-03-27 15:01:59 +0000 |
commit | 0559e08ff40bc2496c6af22beb4df99cf112e13b (patch) | |
tree | d665a5140902bc5dd72da608cf38f8c397fdad21 /Source/TableSource.m | |
parent | cf8f377e47e14498c9f0d3628752b1ea60437cab (diff) | |
download | sequelpro-0559e08ff40bc2496c6af22beb4df99cf112e13b.tar.gz sequelpro-0559e08ff40bc2496c6af22beb4df99cf112e13b.tar.bz2 sequelpro-0559e08ff40bc2496c6af22beb4df99cf112e13b.zip |
- When switching tables, correctly catch disconnections and suppress error dialogs and related crashes
- Move connection error sheet close method to the connection delegate
- Tweak the information_schema db schema building query to be much faster on busy servers by amending the VIEW part
- Set the connection lock to nil after releasing, coping with connection unlocks deferred on the main thread until after dealloc
Diffstat (limited to 'Source/TableSource.m')
-rw-r--r-- | Source/TableSource.m | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Source/TableSource.m b/Source/TableSource.m index 8ccc682e..83e3dde1 100644 --- a/Source/TableSource.m +++ b/Source/TableSource.m @@ -75,15 +75,15 @@ // If an error occurred, reset the interface and abort if ([mySQLConnection queryErrored]) { - NSString *errorMessage = [NSString stringWithString:[mySQLConnection getLastErrorMessage]]; - [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance]; [[self onMainThread] setTableDetails:nil]; - 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]); + if ([mySQLConnection isConnected]) { + 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"), + [mySQLConnection getLastErrorMessage]]); + } if (tableSourceResult) [tableSourceResult release]; return; } @@ -97,15 +97,15 @@ // If an error occurred, reset the interface and abort if ([mySQLConnection queryErrored]) { - NSString *errorMessage = [NSString stringWithString:[mySQLConnection getLastErrorMessage]]; - [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance]; [[self onMainThread] setTableDetails:nil]; - 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]); + if ([mySQLConnection isConnected]) { + 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"), + [mySQLConnection getLastErrorMessage]]); + } if (indexResult) [indexResult release]; return; } |