> Have a look to NH3.
> I have changed some behavior and...ARGGGG!!! in .NET, without add a
> reference to Microsoft.SqlServer.something, there isn't a way to set the
> size to "MAX".

        You could set the size to 2GB-1, which is the max size of a value
for a (n)varchar(max) field anyway.

        It all comes down to the fact whether the developer is required to
specify a length/size parameter for a string/byte-array field mapping. IMHO
it should be mandatory, as you then can have in-memory length validation
before a value hits the DB + you can set the size/maxlength/length property
of a DbParameter to the fixed length you'd want (with oracle, you have a
problem though, as non-stringclob fields mapped on nvarchar2 can only be
4000 long, and not 8000 as with the varchar2, however this info isn't known,
the target type isn't specified. This could lead to truncation.

                FB

> btw, using StringClob, you have the default size set to the max.... wait
let
> me find the issue...
> found http://216.121.112.228/browse/NH-2302
> <http://216.121.112.228/browse/NH-2302> revision 5174
> 
> 
> On Tue, Oct 5, 2010 at 5:24 PM, Michael Teper <[email protected]> wrote:
> 
> 
>       This should be documented as a breaking change for NH3 -- I have a
>       number of strings mapped to nvarchar(max) fields today in 2.1.2 that
>       look like <property name="Blah" /> and work fine with large values.
> 
>       For reference, nvarchar(max) max length is 1,073,741,822 (from
>       http://www.sql-server-helper.com/sql-server-2005/..%5Cfaq%5Csql-
> server-2005-varchar-max-p01.aspx)
> 
>       Thanks!
>       -Michael
> 
> 
> 
>       On Oct 5, 1:17 pm, srf <[email protected]> wrote:
>       > Ya, I figured so, I tried switching to StringClob and it basically
> did
>       > what I mentioned and set the size to a really large size and
worked
> so
>       > Im ok with that and will make that change. Just as an thought,
> would
>       > it be helpfull if when setting the paramter.value we can see that
> the
>       > if the parameter size is less then the length of the text that it
>       > would get cut off and maybe nhibernate should raise a warning or
>       > exception like "hey your text is going to get cuttoff , are you
> sure
>       > you want to do this??" or something like that? you would thing
>       > something farther down like ado.net or sqlserver would also flag
it
>       > too rather than just cutting it off and continuing like nothing
bad
>       > has just happened.
>       >
>       > thanks
>       >
>       > scott
>       >
>       > On Oct 5, 2:05 pm, Ayende Rahien <[email protected]> wrote:
>       >
>       >
>       >
>       > > No, the parameter size should be fixed. That ensures that you
> have
>       > > consistent query plans.
>       > > Specify that the field type is StringClob in the mapping
>       >
>       > > On Tue, Oct 5, 2010 at 9:54 PM, srf <[email protected]> wrote:
>       > > > I was trying to figure out why things working working anymore
> in
>       > > > nhibernate 3 and noticed that in nhibernate 2 the
> dbparameter.size
>       > > > would be set to what the dbparameter.value's length was as
long
> as the
>       > > > dbparameter.size was set to 0. Now in nhibernate 3, the
>       > > > dbparameter.size is getting set because line 164 in
> SqlClientDriver.cs
>       > > > is commented out so its now by default setting the size to
some
> fixed
>       > > > size rather than setting the size to what the parameter value
> size is.
>       > > > So I was wondering why that is commented out now. The problem
I
> have
>       > > > is that I have varchar(max) values and the parameter size
could
> be
>       > > > really large so the parameter size need to be set to what the
> length
>       > > > of the text inserted or sqlserver will just cut it off to
> whatever the
>       > > > parameter.size is. Is handling really large text like
> varchar(max) to
>       > > > be done differently?
>       >
>       > > > thanks
>       >
>       > > > scott- Hide quoted text -
>       >
> 
>       > > - Show quoted text -- Hide quoted text -
>       >
>       > - Show quoted text -
> 
> 
> 
> 
> --
> Fabio Maulo
> 


Reply via email to