Commit 3babf267 authored by Sam Saffron's avatar Sam Saffron

big string support

parent fd9ec2b4
......@@ -259,6 +259,10 @@ private static IDbCommand SetupCommand(IDbConnection cnn, SqlTransaction tranact
if (info.Type == SqlDbType.NVarChar)
{
param.Size = 4000;
if (info.Val != null && ((string)info.Val).Length > 4000)
{
param.Size = -1;
}
}
if (info.Type == SqlDbType.Structured)
......@@ -276,10 +280,14 @@ private static IDbCommand SetupCommand(IDbConnection cnn, SqlTransaction tranact
foreach (var item in list)
{
count++;
var sqlParam = new SqlParameter("@" + info.Name + count, item);
var sqlParam = new SqlParameter("@" + info.Name + count, item ?? DBNull.Value);
if (isString)
{
sqlParam.Size = 4000;
if (item != null && ((string)item).Length > 4000)
{
sqlParam.Size = -1;
}
}
cmd.Parameters.Add(sqlParam);
}
......
......@@ -139,5 +139,12 @@ public void TestExecuteCommand()
drop table #t", new {a=1, b=2 }).IsEquals(2);
}
public void TestMassiveStrings()
{
var str = new string('X', 20000);
connection.ExecuteMapperQuery<string>("select @a", new { a = str }).First()
.IsEquals(str);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment