mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-17 01:25:40 -05:00
extend the list databases request (#951)
* extend the list databases request * reuse databaseInfo and refactor * fix typo
This commit is contained in:
@@ -16,17 +16,17 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Utility
|
||||
public class TestDbException : DbException
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public class TestDbDataReader : DbDataReader, IDbColumnSchemaGenerator
|
||||
{
|
||||
#region Test Specific Implementations
|
||||
|
||||
|
||||
private IEnumerable<TestResultSet> Data { get; }
|
||||
|
||||
private IEnumerator<TestResultSet> ResultSetEnumerator { get; }
|
||||
|
||||
private IEnumerator<object[]> RowEnumerator { get; set; }
|
||||
|
||||
|
||||
private bool ThrowOnRead { get; }
|
||||
|
||||
public TestDbDataReader(IEnumerable<TestResultSet> data, bool throwOnRead)
|
||||
@@ -140,7 +140,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Utility
|
||||
{
|
||||
if (ResultSetEnumerator.Current.Columns[ordinal].DataType == typeof(byte[]))
|
||||
{
|
||||
byte[] data = (byte[]) this[ordinal];
|
||||
byte[] data = (byte[])this[ordinal];
|
||||
if (buffer == null)
|
||||
{
|
||||
return data.Length;
|
||||
@@ -173,11 +173,11 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Utility
|
||||
|
||||
public override long GetChars(int ordinal, long dataOffset, char[] buffer, int bufferOffset, int length)
|
||||
{
|
||||
char[] allChars = ((string) RowEnumerator.Current[ordinal]).ToCharArray();
|
||||
char[] allChars = ((string)RowEnumerator.Current[ordinal]).ToCharArray();
|
||||
int outLength = allChars.Length;
|
||||
if (buffer != null)
|
||||
{
|
||||
Array.Copy(allChars, (int) dataOffset, buffer, bufferOffset, outLength);
|
||||
Array.Copy(allChars, (int)dataOffset, buffer, bufferOffset, outLength);
|
||||
}
|
||||
return outLength;
|
||||
}
|
||||
@@ -256,7 +256,12 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Utility
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var column = ResultSetEnumerator?.Current.Columns.FindIndex(c => c.ColumnName == name);
|
||||
if (!column.HasValue)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
return RowEnumerator.Current[column.Value];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user