handle large decimal (#1326)

This commit is contained in:
Alan Ren
2021-12-02 09:45:45 -08:00
committed by GitHub
parent f9e7b22697
commit fd5b8af0c0
4 changed files with 33 additions and 19 deletions

View File

@@ -44,6 +44,20 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.QueryExecution.DataSt
Assert.NotNull(bytes);
}
/// <summary>
/// Validate GetBytesWithMaxCapacity
/// </summary>
[Test]
public void GetLongDecimalTest()
{
// SQL Server support up to 38 digits of decimal
var storageReader = GetTestStorageDataReader(
"SELECT 99999999999999999999999999999999999999");
storageReader.DbDataReader.Read();
var value = storageReader.GetValue(0);
Assert.AreEqual("99999999999999999999999999999999999999", value.ToString());
}
/// <summary>
/// Validate GetCharsWithMaxCapacity
/// </summary>
@@ -63,7 +77,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.QueryExecution.DataSt
Assert.True(shortName.Length == 2);
Assert.Throws<ArgumentOutOfRangeException>(() => storageReader.GetBytesWithMaxCapacity(0, 0));
Assert.Throws<ArgumentOutOfRangeException>(() => storageReader.GetCharsWithMaxCapacity(0, 0));
Assert.Throws<ArgumentOutOfRangeException>(() => storageReader.GetCharsWithMaxCapacity(0, 0));
}
/// <summary>
@@ -94,10 +108,10 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.QueryExecution.DataSt
writer.Write(output);
Assert.True(writer.ToString().Equals(output));
writer.Write('.');
Assert.True(writer.ToString().Equals(output + '.'));
Assert.True(writer.ToString().Equals(output + '.'));
writer.Write(output);
writer.Write('.');
Assert.True(writer.ToString().Equals(output + '.'));
}
}
}
}