rails-sqlserver / activerecord-sqlserver-adapter

SQL Server Adapter For Rails
MIT License
972 stars 558 forks source link

varchar(max) fields truncating to 4096 chars #181

Closed Lunat1k closed 12 years ago

Lunat1k commented 12 years ago

As I was working with redmine I see that it stores the data properly in the varchar(max) field. however after it retrieves the data from the database it is only returning 4096 chars back to redmine.

Lunat1k commented 12 years ago

It also only returns 2048 chars for nvarchar(max) fields.

Lunat1k commented 12 years ago

Text field type also only returns 4096 chars.

metaskills commented 12 years ago

This has nothing to do with the adapter, it is a SQL Server thing. Clients can configure their default text size, google for "sql server set textsize" and you will see.

FYI, the adapter provides hooks for you to configure your connection. See the README in the section called "Configure Connection & App Name"

Lunat1k commented 12 years ago

I think the adapter should default to 2147483647 just like microsoft does.

"The SQL Server Native Client ODBC driver and SQL Server Native Client OLE DB Provider for SQL Server automatically set TEXTSIZE to 2147483647 when connecting."

http://msdn.microsoft.com/en-us/library/ms186238.aspx

metaskills commented 12 years ago

Fair enough.

Lunat1k commented 12 years ago

Thanks for the tip. I guess I never noticed it before since ole & ado both default to that value. which is why I think it's a good idea to default it like they do so others don't get confused.

However setting the value as indicated has fixed the problem

metaskills commented 12 years ago

No worries, I'll put this in some upcoming version. We already have a few SET ... things for TinyTDS to make it more inline with a basic ODBC connection.

andreacfm commented 12 years ago

Is this already being released?

metaskills commented 12 years ago

Yup.