Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZoltan Varga <vargaz@gmail.com>2014-10-30 21:39:38 +0300
committerZoltan Varga <vargaz@gmail.com>2014-10-30 21:39:44 +0300
commitf269254917ea7362bf8248e121303b4756ed6834 (patch)
tree68d4af8ade216ce58d8f29b9c5860754ff175195 /mcs/class/Mono.Data.Tds
parent112079b844ae91cbf592292041a52947c4974b65 (diff)
[Mono.Data.Tds] Allow sending of text data longer than 4000 characters by using a different column type. Fixes #21172.
Diffstat (limited to 'mcs/class/Mono.Data.Tds')
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds70.cs13
1 files changed, 13 insertions, 0 deletions
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds70.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds70.cs
index 991727bbc00..2f4fef03e19 100644
--- a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds70.cs
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds70.cs
@@ -489,6 +489,19 @@ namespace Mono.Data.Tds.Protocol
Comm.Append ((byte) 0x00); // no param meta data name
Comm.Append ((byte) 0x00); // no status flags
+
+ // Convert BigNVarChar values larger than 4000 chars to nvarchar(max)
+ // Need to do this here so WritePreparedParameterInfo emit the
+ // correct data type
+ foreach (TdsMetaParameter param2 in parameters) {
+ var colType = param2.GetMetaType ();
+
+ if (colType == TdsColumnType.BigNVarChar) {
+ int size = param2.GetActualSize ();
+ if ((size >> 1) > 4000)
+ param2.Size = -1;
+ }
+ }
// Write sql as a parameter value - UCS2
TdsMetaParameter param = new TdsMetaParameter ("sql",