Update of nvarchar/nchar columns with sqlserver_adapter.rb
Reported by robinschnyder | July 16th, 2008 @ 01:35 PM
Updating columns of MS SQL server that are either nvarchar or nchar with UTF-8 values are not handled properly.
The sql statement should have leading N before quoted string values.
Small fix of method quote:
...
if value.acts_like?(:time)
"'#{value.strftime("%Y%m%d %H:%M:%S")}'"
elsif value.acts_like?(:date)
"'#{value.strftime("%Y%m%d")}'"
- ---- Begin of fix ----
elsif value.class == String && column && column.sql_type[0,4] == 'nvar'
"N'#{quote_string(value)}'" # ' (for ruby-mode)
- ---- End of fix ----
else
super
end
...
There might be a more elegant solution to this problem.
Comments and changes to this ticket
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
