aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb
diff options
context:
space:
mode:
authorMarcel Molina <marcel@vernix.org>2005-10-07 00:53:05 +0000
committerMarcel Molina <marcel@vernix.org>2005-10-07 00:53:05 +0000
commitf218771d3e9240337cd309d8396b5479d9ff555d (patch)
treefff575cdb78a46551457ed60578d28eb8b37d56e /activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb
parentc0899bca10af443d3aba00d75c554b96d4bccdab (diff)
downloadrails-f218771d3e9240337cd309d8396b5479d9ff555d.tar.gz
rails-f218771d3e9240337cd309d8396b5479d9ff555d.tar.bz2
rails-f218771d3e9240337cd309d8396b5479d9ff555d.zip
Add option (true by default) to generate reader methods for each attribute of a record to avoid the overhead of calling method missing. In partial fullfilment of #1236.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2483 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb
index c1c9ae6f4b..253c8f4e88 100644
--- a/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb
@@ -98,7 +98,7 @@ module ActiveRecord
# These methods will only allow the adapter to insert binary data with a length of 7K or less
# because of a SQL Server statement length policy.
- def string_to_binary(value)
+ def self.string_to_binary(value)
value.gsub(/(\r|\n|\0|\x1a)/) do
case $1
when "\r" then "%00"
@@ -109,7 +109,7 @@ module ActiveRecord
end
end
- def binary_to_string(value)
+ def self.binary_to_string(value)
value.gsub(/(%00|%01|%02|%03)/) do
case $1
when "%00" then "\r"
@@ -275,7 +275,7 @@ module ActiveRecord
case value
when String
if column && column.type == :binary
- "'#{quote_string(column.string_to_binary(value))}'"
+ "'#{quote_string(column.class.string_to_binary(value))}'"
else
"'#{quote_string(value)}'"
end