diff options
-rw-r--r-- | Source/CMMCPConnection.h | 2 | ||||
-rw-r--r-- | Source/CMMCPConnection.m | 31 |
2 files changed, 33 insertions, 0 deletions
diff --git a/Source/CMMCPConnection.h b/Source/CMMCPConnection.h index a9b2554e..f07c9786 100644 --- a/Source/CMMCPConnection.h +++ b/Source/CMMCPConnection.h @@ -63,7 +63,9 @@ - (BOOL) reconnect; - (IBAction) closeSheet:(id)sender; - (void) setParentWindow:(NSWindow *)theWindow; +- (BOOL) selectDB:(NSString *) dbName; - (CMMCPResult *) queryString:(NSString *) query; +- (MCPResult *) listDBsLike:(NSString *) dbsName; - (BOOL) checkConnection; - (void) setDelegate:(id)object; - (NSTimeZone *) timeZone; 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. */ |