Fix: GUIDs not being stored as Guids (#461)

* Fixing issue where Guids weren't being stored in the service buffer file as Guids

* Removing unnecessary ReadSqlGuid method

* Adding unit test for revert cell integration

* Adding unit test for edit session initialization

* Revert "Adding unit test for revert cell integration"

This reverts commit a949926f2ebbb0c39f776edba76d999af4f3f3e9.

* Revert "Adding unit test for edit session initialization"

This reverts commit ff9e5a7d0e5392b27257e57db64879699d73d21c.
This commit is contained in:
Benjamin Russell
2017-09-20 09:59:25 -07:00
committed by GitHub
parent a35cd8ed2b
commit 5cf779fd23
3 changed files with 19 additions and 15 deletions

View File

@@ -81,6 +81,7 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution.DataStorage
{typeof(DateTimeOffset), (o, id, col) => ReadDateTimeOffset(o, id)},
{typeof(TimeSpan), (o, id, col) => ReadTimeSpan(o, id)},
{typeof(byte[]), (o, id, col) => ReadBytes(o, id)},
{typeof(Guid), (o, id, col) => ReadGuid(o, id)},
{typeof(SqlString), (o, id, col) => ReadString(o, id)},
{typeof(SqlInt16), (o, id, col) => ReadInt16(o, id)},
@@ -467,14 +468,14 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution.DataStorage
/// </summary>
/// <param name="offset">Offset into the file to read the bytes from</param>
/// <param name="rowId">Internal ID of the row that will be stored in the cell</param>
/// <returns>A guid type object</returns>
/// <returns>A system guid type object</returns>
internal FileStreamReadResult ReadGuid(long offset, long rowId)
{
return ReadCellHelper(offset, rowId, length =>
{
byte[] output = new byte[length];
Buffer.BlockCopy(buffer, 0, output, 0, length);
return new SqlGuid(output);
return new Guid(output);
}, totalLength => totalLength == 1);
}

View File

@@ -90,6 +90,7 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution.DataStorage
{typeof(DateTimeOffset), val => WriteDateTimeOffset((DateTimeOffset) val) },
{typeof(TimeSpan), val => WriteTimeSpan((TimeSpan) val) },
{typeof(byte[]), val => WriteBytes((byte[]) val)},
{typeof(Guid), val => WriteGuid((Guid) val)},
{typeof(SqlString), val => WriteNullable((SqlString) val, obj => WriteString((string) obj))},
{typeof(SqlInt16), val => WriteNullable((SqlInt16) val, obj => WriteInt16((short) obj))},