diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-03-19 16:21:10 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-03-19 16:21:10 +0000 |
commit | 8a7621ee68c7de9a08bbd1552c6006e4fa3aaaa9 (patch) | |
tree | 469e94974d25ebbccb1d174d2fb921e063809be9 /Source/TableDocument.m | |
parent | e1e725ef1c285f28cbbb6f4b4e8ef86b011aa34e (diff) | |
download | sequelpro-8a7621ee68c7de9a08bbd1552c6006e4fa3aaaa9.tar.gz sequelpro-8a7621ee68c7de9a08bbd1552c6006e4fa3aaaa9.tar.bz2 sequelpro-8a7621ee68c7de9a08bbd1552c6006e4fa3aaaa9.zip |
• further work on Navigator (not yet active but workable -> unHide menu item)
Diffstat (limited to 'Source/TableDocument.m')
-rw-r--r-- | Source/TableDocument.m | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/Source/TableDocument.m b/Source/TableDocument.m index d741c55d..1616e659 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -1181,6 +1181,16 @@ } } +/* + * Called from MCPConnection or self to inform the navigator that an instance invoked queryDbStructure + * or a window was closed + */ +- (void)updateNavigator:(id)sender +{ + if([[[SPNavigatorController sharedNavigatorController] window] isVisible]) + [[SPNavigatorController sharedNavigatorController] updateEntries:self]; +} + #pragma mark - #pragma mark Task progress and notification methods @@ -2393,6 +2403,44 @@ } /** + * Returns a string to identify the connection uniquely (mainly used to set up db structure with unique keys) + */ +- (NSString *)connectionID +{ + + if(!_isConnected) return @"_"; + + NSString *port; + if([[self port] length]) + port = [NSString stringWithFormat:@":%@", [self port]]; + else + port = @""; + + switch([connectionController type]) { + case SPSocketConnection: + return [NSString stringWithFormat:@"%@@localhost%@", ([connectionController user] && [[connectionController user] length])?[connectionController user]:@"anonymous", port]; + break; + case SPTCPIPConnection: + return [NSString stringWithFormat:@"%@@%@%@", + ([connectionController user] && [[connectionController user] length])?[connectionController user]:@"anonymous", + [connectionController host]?[connectionController host]:@"", + port]; + break; + case SPSSHTunnelConnection: + return [NSString stringWithFormat:@"%@@%@%@&SSH&%@@%@:%@", + ([connectionController user] && [[connectionController user] length])?[connectionController user]:@"anonymous", + [connectionController host]?[connectionController host]:@"", + port, + ([connectionController sshUser] && [[connectionController sshUser] length])?[connectionController sshUser]:@"anonymous", + [connectionController sshHost]?[connectionController sshHost]:@"", + ([[connectionController sshPort] length])?[connectionController sshPort]:@"22"]; + } + + return @"_"; + +} + +/** * Returns the currently selected database */ - (NSString *)database @@ -3608,7 +3656,7 @@ if (_isConnected) [self closeConnection]; else [connectionController cancelConnection]; if ([[[SPQueryController sharedQueryController] window] isVisible]) [self toggleConsole:self]; - if ([[[SPNavigatorController sharedNavigatorController] window] isVisible]) [self toggleNavigator:self]; + if ([[[SPNavigatorController sharedNavigatorController] window] isVisible]) [self updateNavigator:self]; [createTableSyntaxWindow orderOut:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self]; } |