aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h1
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m10
-rw-r--r--Source/TableDocument.m9
3 files changed, 17 insertions, 3 deletions
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h
index a49112b0..548425e1 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h
@@ -65,6 +65,7 @@ static inline NSData* NSStringDataUsingLossyEncoding(NSString* self, NSInteger e
- (NSString *)keychainPasswordForConnection:(id)connection;
- (NSString *)onReconnectShouldSelectDatabase:(id)connection;
- (NSString *)onReconnectShouldUseEncoding:(id)connection;
+- (void)noConnectionAvailable:(id)connection;
- (MCPConnectionCheck)connectionLost:(id)connection;
@end
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
index 456b615d..e55568d5 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
@@ -1266,11 +1266,15 @@ void performThreadedKeepAlive(void *ptr)
if (!mConnected) {
// Write a log entry
if ([delegate respondsToSelector:@selector(queryGaveError:connection:)]) [delegate queryGaveError:@"No connection available!" connection:self];
+
// Notify that the query has been performed
[[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:delegate];
- // Show an error alert while resetting
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), @"No connection available!",
- nil, nil, [delegate valueForKeyPath:@"tableWindow"], self, nil, nil, nil, @"No connection available!");
+
+ // Inform the delegate that there is no connection available
+ if (delegate && [delegate respondsToSelector:@selector(noConnectionAvailable:)]) {
+ [delegate noConnectionAvailable:self];
+ }
+
return nil;
}
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index e8187334..71ac951f 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -3565,6 +3565,15 @@
}
/**
+ * Invoked when an attempt was made to execute a query on the current connection, but the connection is not
+ * actually active.
+ */
+- (void)noConnectionAvailable:(id)connection
+{
+ NSBeginAlertSheet(NSLocalizedString(@"No connection available", @"no connection available message"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, NSLocalizedString(@"An error has occured and there doesn't seem to be a connection available.", @"no connection available informatie message"));
+}
+
+/**
* Invoked when the connection fails and the framework needs to know how to proceed.
*/
- (MCPConnectionCheck)connectionLost:(id)connection