varchar(max) fields truncating to 4096 chars #181

Closed
Lunat1k opened this Issue Apr 13, 2012 · 9 comments

Comments

Projects
None yet
3 participants

Lunat1k commented Apr 13, 2012

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 Apr 13, 2012

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

Lunat1k commented Apr 13, 2012

Text field type also only returns 4096 chars.

Collaborator

metaskills commented Apr 13, 2012

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"

metaskills closed this Apr 13, 2012

Lunat1k commented Apr 13, 2012

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 reopened this Apr 13, 2012

Collaborator

metaskills commented Apr 13, 2012

Fair enough.

Lunat1k commented Apr 13, 2012

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

Collaborator

metaskills commented Apr 13, 2012

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.

Is this already being released?

Collaborator

metaskills commented Apr 20, 2012

Yup.

@gicappa gicappa pushed a commit to gicappa/activerecord-sqlserver-adapter that referenced this issue Jun 5, 2012

@metaskills metaskills Tons of bug fixes.
* Fix exists? with offset by patching visitor. Fixes #171 and Fixes #167
* Set default text size to 2147483647 for TinyTDS connections. Fixes #181
* Set @config ivar for 3rd party libs. Fixes #177
* Make #sql_type_for_statement work for integers that may have empty parens or none at all. Fixes #175
8c9f89e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment