diff options
author | Stuart Connolly <stuart02@gmail.com> | 2014-08-28 19:08:14 +0100 |
---|---|---|
committer | Stuart Connolly <stuart02@gmail.com> | 2014-08-28 19:08:14 +0100 |
commit | 310fb079c75d551bf2a129b69c897905ca83e061 (patch) | |
tree | ae163e957f6e43c49fef9014a96f8cab7b99cbfa /Source/SPConnectionDelegate.m | |
parent | e3c342d623b24a55215fadb3b7c72f80df303e83 (diff) | |
download | sequelpro-310fb079c75d551bf2a129b69c897905ca83e061.tar.gz sequelpro-310fb079c75d551bf2a129b69c897905ca83e061.tar.bz2 sequelpro-310fb079c75d551bf2a129b69c897905ca83e061.zip |
Resolve #1938: In the query console display the database the query was executed in.
Diffstat (limited to 'Source/SPConnectionDelegate.m')
-rw-r--r-- | Source/SPConnectionDelegate.m | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/Source/SPConnectionDelegate.m b/Source/SPConnectionDelegate.m index b7bbc47e..caf7926c 100644 --- a/Source/SPConnectionDelegate.m +++ b/Source/SPConnectionDelegate.m @@ -48,11 +48,11 @@ { #ifndef SP_CODA if ([prefs boolForKey:SPConsoleEnableLogging]) { - if ((_queryMode == SPInterfaceQueryMode && [prefs boolForKey:SPConsoleEnableInterfaceLogging]) - || (_queryMode == SPCustomQueryQueryMode && [prefs boolForKey:SPConsoleEnableCustomQueryLogging]) - || (_queryMode == SPImportExportQueryMode && [prefs boolForKey:SPConsoleEnableImportExportLogging])) + if ((_queryMode == SPInterfaceQueryMode && [prefs boolForKey:SPConsoleEnableInterfaceLogging]) || + (_queryMode == SPCustomQueryQueryMode && [prefs boolForKey:SPConsoleEnableCustomQueryLogging]) || + (_queryMode == SPImportExportQueryMode && [prefs boolForKey:SPConsoleEnableImportExportLogging])) { - [[SPQueryController sharedQueryController] showMessageInConsole:query connection:[self name]]; + [[SPQueryController sharedQueryController] showMessageInConsole:query connection:[self name] database:[self database]]; } } #endif @@ -65,7 +65,7 @@ { #ifndef SP_CODA if ([prefs boolForKey:SPConsoleEnableLogging] && [prefs boolForKey:SPConsoleEnableErrorLogging]) { - [[SPQueryController sharedQueryController] showErrorInConsole:error connection:[self name]]; + [[SPQueryController sharedQueryController] showErrorInConsole:error connection:[self name] database:[self database]]; } #endif } @@ -75,7 +75,6 @@ */ - (NSString *)keychainPasswordForConnection:(SPMySQLConnection *)connection { - // If no keychain item is available, return an empty password if (![connectionController connectionKeychainItemName]) return nil; @@ -96,23 +95,26 @@ */ - (NSString *)keychainPasswordForSSHConnection:(SPMySQLConnection *)connection { - // If no keychain item is available, return an empty password if (![connectionController connectionKeychainItemName]) return @""; // Otherwise, pull the password from the keychain using the details from this connection SPKeychain *keychain = [[SPKeychain alloc] init]; + NSString *connectionSSHKeychainItemName = [[keychain nameForSSHForFavoriteName:[connectionController name] id:[self keyChainID]] retain]; NSString *connectionSSHKeychainItemAccount = [[keychain accountForSSHUser:[connectionController sshUser] sshHost:[connectionController sshHost]] retain]; - NSString *sshpw = [keychain getPasswordForName:connectionSSHKeychainItemName account:connectionSSHKeychainItemAccount]; - if (!sshpw || ![sshpw length]) - sshpw = @""; + NSString *sshPassword = [keychain getPasswordForName:connectionSSHKeychainItemName account:connectionSSHKeychainItemAccount]; + + if (!sshPassword || ![sshPassword length]) { + sshPassword = @""; + } + + if (connectionSSHKeychainItemName) [connectionSSHKeychainItemName release]; + if (connectionSSHKeychainItemAccount) [connectionSSHKeychainItemAccount release]; - if(connectionSSHKeychainItemName) [connectionSSHKeychainItemName release]; - if(connectionSSHKeychainItemAccount) [connectionSSHKeychainItemAccount release]; [keychain release]; - return sshpw; + return sshPassword; } /** @@ -121,7 +123,17 @@ */ - (void)noConnectionAvailable:(id)connection { - SPBeginAlertSheet(NSLocalizedString(@"No connection available", @"no connection available message"), NSLocalizedString(@"OK", @"OK button"), nil, nil, [self parentWindow], self, nil, nil, NSLocalizedString(@"An error has occured and there doesn't seem to be a connection available.", @"no connection available informatie message")); + SPBeginAlertSheet( + NSLocalizedString(@"No connection available", @"no connection available message"), + NSLocalizedString(@"OK", @"OK button"), + nil, + nil, + [self parentWindow], + self, + nil, + nil, + NSLocalizedString(@"An error has occured and there doesn't seem to be a connection available.", @"no connection available informatie message") + ); } /** |