mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 01:25:40 -05:00
Connect should return actual DB Name (#42)
- On Connecting to a server with no DB specified, we will actually get a connection to Master or some default DB. - This DB should be used when notifying others of a new connection, and when returning information to the caller so that the correct name can be displayed in the UI. - Added basic unit tests to cover this scenario
This commit is contained in:
@@ -169,6 +169,16 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection
|
||||
|
||||
ownerToConnectionMap[connectionParams.OwnerUri] = connectionInfo;
|
||||
|
||||
// Update with the actual database name in connectionInfo and result
|
||||
// Doing this here as we know the connection is open - expect to do this only on connecting
|
||||
connectionInfo.ConnectionDetails.DatabaseName = connectionInfo.SqlConnection.Database;
|
||||
response.ConnectionSummary = new ConnectionSummary()
|
||||
{
|
||||
ServerName = connectionInfo.ConnectionDetails.ServerName,
|
||||
DatabaseName = connectionInfo.ConnectionDetails.DatabaseName,
|
||||
UserName = connectionInfo.ConnectionDetails.UserName,
|
||||
};
|
||||
|
||||
// invoke callback notifications
|
||||
foreach (var activity in this.onConnectionActivities)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user