aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/MCPKit/MCPFoundationKit
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2010-07-19 22:26:22 +0000
committerrowanbeentje <rowan@beent.je>2010-07-19 22:26:22 +0000
commita5f4c3274ac06be78f78200ae486037e9b1a8910 (patch)
tree06e136ae385e81e8ce7afd1a73012ce96f82c4cd /Frameworks/MCPKit/MCPFoundationKit
parentfe499cde3cee2acf911273b7889a60160150c158 (diff)
downloadsequelpro-a5f4c3274ac06be78f78200ae486037e9b1a8910.tar.gz
sequelpro-a5f4c3274ac06be78f78200ae486037e9b1a8910.tar.bz2
sequelpro-a5f4c3274ac06be78f78200ae486037e9b1a8910.zip
- Clean up SPDataImport, removing unused methods and cleaning up order and methods
- Improve error handling when the connecting dies during import (previous the sheet would stay open) - Fix localised strings for error messages (label and text the wrong way round) - Improve comments
Diffstat (limited to 'Frameworks/MCPKit/MCPFoundationKit')
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h2
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m13
2 files changed, 15 insertions, 0 deletions
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h
index 66f76083..adcecb05 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h
@@ -141,6 +141,7 @@
BOOL useKeepAlive;
BOOL isDisconnecting;
+ BOOL userTriggeredDisconnect;
NSInteger connectionTimeout;
CGFloat keepAliveInterval;
@@ -227,6 +228,7 @@
- (void)disconnect;
- (BOOL)reconnect;
- (BOOL)isConnected;
+- (BOOL)userTriggeredDisconnect;
- (BOOL)checkConnection;
- (BOOL)pingConnection;
void pingConnectionTask(void *ptr);
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
index 143152d2..56073806 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
@@ -118,6 +118,7 @@ static BOOL sTruncateLongFieldInLogs = YES;
serverVersionString = nil;
mTimeZone = nil;
isDisconnecting = NO;
+ userTriggeredDisconnect = NO;
automaticReconnectAttempts = 0;
pingFailureCount = 0;
@@ -395,6 +396,7 @@ static BOOL sTruncateLongFieldInLogs = YES;
}
mConnected = YES;
+ userTriggeredDisconnect = NO;
connectionStartTime = mach_absolute_time();
lastKeepAliveTime = 0;
automaticReconnectAttempts = 0;
@@ -598,6 +600,7 @@ static BOOL sTruncateLongFieldInLogs = YES;
switch (failureDecision) {
case MCPConnectionCheckDisconnect:
[self setLastErrorMessage:NSLocalizedString(@"User triggered disconnection", @"User triggered disconnection")];
+ userTriggeredDisconnect = YES;
[reconnectionPool release];
return NO;
default:
@@ -619,6 +622,15 @@ static BOOL sTruncateLongFieldInLogs = YES;
}
/**
+ * Returns YES if the user chose to disconnect at the last "connection failure"
+ * prompt, NO otherwise.
+ */
+- (BOOL)userTriggeredDisconnect
+{
+ return userTriggeredDisconnect;
+}
+
+/**
* Checks if the connection to the server is still on.
* If not, tries to reconnect (changing no parameters from the MYSQL pointer).
* This method just uses mysql_ping().
@@ -670,6 +682,7 @@ static BOOL sTruncateLongFieldInLogs = YES;
case MCPConnectionCheckDisconnect:
if (mConnected) [self disconnect];
[self setLastErrorMessage:NSLocalizedString(@"User triggered disconnection", @"User triggered disconnection")];
+ userTriggeredDisconnect = YES;
return NO;
// 'Retry' has been selected - return a recursive call.