aboutsummaryrefslogtreecommitdiffstats
path: root/Source/CMMCPConnection.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-02-28 01:47:25 +0000
committerrowanbeentje <rowan@beent.je>2009-02-28 01:47:25 +0000
commit2ca51225df3ee5badc4029761db3f32a68bfb140 (patch)
tree6155624574fdd05cd4d1fea96c07bf110936a4f6 /Source/CMMCPConnection.m
parent3e07d763113142a857dc8f1243571a1ae2360c58 (diff)
downloadsequelpro-2ca51225df3ee5badc4029761db3f32a68bfb140.tar.gz
sequelpro-2ca51225df3ee5badc4029761db3f32a68bfb140.tar.bz2
sequelpro-2ca51225df3ee5badc4029761db3f32a68bfb140.zip
Applies connection checks and keepalive logic to select database/refresh databases queries. This fixes Issue #176.
Diffstat (limited to 'Source/CMMCPConnection.m')
-rw-r--r--Source/CMMCPConnection.m31
1 files changed, 31 insertions, 0 deletions
diff --git a/Source/CMMCPConnection.m b/Source/CMMCPConnection.m
index 5319f42f..11f60b97 100644
--- a/Source/CMMCPConnection.m
+++ b/Source/CMMCPConnection.m
@@ -287,6 +287,23 @@ WARNING : incomplete implementation. Please, send your fixes.
/*
+ * Modified version of selectDB to be used in Sequel Pro.
+ * Checks the connection exists, and handles keepalive, otherwise calling the parent implementation.
+ */
+- (BOOL) selectDB:(NSString *) dbName
+{
+ if (!mConnected) return NO;
+ [self stopKeepAliveTimer];
+ if (![self checkConnection]) return NO;
+ if ([super selectDB:dbName]) {
+ [self startKeepAliveTimerResettingState:YES];
+ return YES;
+ }
+ return NO;
+}
+
+
+/*
* Modified version of queryString to be used in Sequel Pro.
* Error checks extensively - if this method fails, it will ask how to proceed and loop depending
* on the status, not returning control until either the query has been executed and the result can
@@ -337,6 +354,20 @@ WARNING : incomplete implementation. Please, send your fixes.
/*
+ * Modified version of selectDB to be used in Sequel Pro.
+ * Checks the connection exists, and handles keepalive, otherwise calling the parent implementation.
+ */
+- (MCPResult *) listDBsLike:(NSString *) dbsName
+{
+ if (!mConnected) return NO;
+ [self stopKeepAliveTimer];
+ if (![self checkConnection]) return [[[MCPResult alloc] init] autorelease];
+ [self startKeepAliveTimerResettingState:YES];
+ return [super listDBsLike:dbsName];
+}
+
+
+/*
* Checks whether the connection to the server is still active. If not, prompts for what approach to take,
* offering to retry, reconnect or disconnect the connection.
*/