Describe the bug
TDS_BLOBs are not being terminated correctly
To Reproduce
Run script
create table [dbo].[test] (
text_field text null,
d datetime null
)
Execute the following C#
var value = new string('1', 4097);
using (var connection = GetConnection())
{
connection.Execute("set textsize 1000000");
var p = new DynamicParameters();
p.Add("@text_field", value, DbType.String);
p.Add("@d", new DateTime(2000, 1, 1));
connection.Execute("insert into [dbo].[test] (text_field, d) values (@text_field, @d)", p);
}
Observe the C# throws an exception AdoNetCore.AseClient.AseException : The parameter of type 49 did not have a valid value.
When the length of the text_field exceeds 4096 characters, the driver uses TDS_BLOB to send it to the database. The TDS_BLOB is not terminated correctly. This causes an issue only when other parameters follow (like the @d parameter). No issue occurs if there are no parameters following.
Expected behavior
The driver should terminate the TDS_BLOB correctly so strings larger than 4096 characters can be inserted.
TDS_BLOBs should only be used when the text_field is larger than 8192 characters.
Describe the bug TDS_BLOBs are not being terminated correctly
To Reproduce
Run script
Execute the following C#
Observe the C# throws an exception
AdoNetCore.AseClient.AseException : The parameter of type 49 did not have a valid value.
When the length of the text_field exceeds 4096 characters, the driver uses TDS_BLOB to send it to the database. The TDS_BLOB is not terminated correctly. This causes an issue only when other parameters follow (like the
@d
parameter). No issue occurs if there are no parameters following.Expected behavior The driver should terminate the TDS_BLOB correctly so strings larger than 4096 characters can be inserted. TDS_BLOBs should only be used when the text_field is larger than 8192 characters.
Environment
Core 2.1
AdoNetCore.AseClient
nuget package version0.16