fix decimal datatype handling (#1352)

* Revert "Revert query execution changes (#1341)"

This reverts commit cb290cdbb5.

* fix decimal and money

* timestamp

* fix code and tests

* add sql variant test
This commit is contained in:
Alan Ren
2022-01-04 13:56:12 -08:00
committed by GitHub
parent 18ca177767
commit 995e9baeab
8 changed files with 304 additions and 26 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 + '.'));
}
}
}
}