Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Added support for param values to be longer than 4000 characters #38

Closed
wants to merge 2 commits into from

2 participants

@codeimpossible

I was pretty surprised when I found that I couldn't insert more than 4000 characters using Massive. I submitted a patch yesterday but I closed it after DataChomp pointed out that it broke query plan caching.

The patch I have here checks the length of the value in the param and if the length is greater than 4000 it sets the length to -1 assuming that the param is going against a ntext/nvarchar(max) column.

Jared Barboza and others added some commits
@robconery robconery closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 14, 2011
Commits on Apr 16, 2011
  1. @codeimpossible

    modified my patch, added a check against the length. if the lenght is…

    codeimpossible authored
    … greater than 4000 then it is assumed we are using a ntext or nvarchar(max)
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 1 deletion.
  1. +4 −1 Massive.cs
View
5 Massive.cs
@@ -40,8 +40,11 @@ public static class ObjectExtensions {
p.Value = item;
}
//from DataChomp
+ // jared: added a check for the length here
+ // if the length is greater than 4000 then it is
+ // assumed we are saving a ntext or nvarchar(max)
if (item.GetType() == typeof(string))
- p.Size = 4000;
+ p.Size = ((string)item).Length > 4000 ? -1 : 4000;
}
cmd.Parameters.Add(p);
}
Something went wrong with that request. Please try again.