mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-22 09:35:38 -05:00
Add force change database logic (#519)
* add logic to close connections if changing fails * added logic to close connections and reopen that fail to change (azure) * expose connection map in connection info, change while to foreach * removed unneeded code * reworked logic to not depend on thrown errors * added tests
This commit is contained in:
@@ -194,8 +194,14 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Utility
|
||||
public class TestSqlConnection : DbConnection
|
||||
{
|
||||
private string _database;
|
||||
private ConnectionState _state;
|
||||
|
||||
internal TestSqlConnection(TestResultSet[] data)
|
||||
public TestSqlConnection()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public TestSqlConnection(TestResultSet[] data)
|
||||
{
|
||||
Data = data;
|
||||
}
|
||||
@@ -227,7 +233,11 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Utility
|
||||
get { return _database; }
|
||||
}
|
||||
|
||||
public override ConnectionState State { get; }
|
||||
public override ConnectionState State
|
||||
{
|
||||
get { return _state; }
|
||||
}
|
||||
|
||||
public override string DataSource { get; }
|
||||
public override string ServerVersion { get; }
|
||||
|
||||
@@ -238,7 +248,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Utility
|
||||
|
||||
public override void ChangeDatabase(string databaseName)
|
||||
{
|
||||
// No Op
|
||||
_database = databaseName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -249,6 +259,11 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Utility
|
||||
{
|
||||
this._database = database;
|
||||
}
|
||||
|
||||
public void SetState(ConnectionState state)
|
||||
{
|
||||
this._state = state;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user