SQLite: binary escaping works with ='u'. Closes #7862.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6449 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jeremy Kemper 2007-03-19 12:49:23 +00:00
parent 65704aeacd
commit b5e01f3e4a
2 changed files with 4 additions and 2 deletions

View File

@ -1,5 +1,7 @@
*SVN* *SVN*
* SQLite: binary escaping works with $KCODE='u'. #7862 [tsuka]
* Base#to_xml supports serialized attributes. #7502 [jonathan] * Base#to_xml supports serialized attributes. #7502 [jonathan]
* Base.update_all :order and :limit options. Useful for MySQL updates that must be ordered to avoid violating unique constraints. [Jeremy Kemper] * Base.update_all :order and :limit options. Useful for MySQL updates that must be ordered to avoid violating unique constraints. [Jeremy Kemper]

View File

@ -68,7 +68,7 @@ module ActiveRecord
class SQLiteColumn < Column #:nodoc: class SQLiteColumn < Column #:nodoc:
class << self class << self
def string_to_binary(value) def string_to_binary(value)
value.gsub(/\0|\%/) do |b| value.gsub(/\0|\%/n) do |b|
case b case b
when "\0" then "%00" when "\0" then "%00"
when "%" then "%25" when "%" then "%25"
@ -77,7 +77,7 @@ module ActiveRecord
end end
def binary_to_string(value) def binary_to_string(value)
value.gsub(/%00|%25/) do |b| value.gsub(/%00|%25/n) do |b|
case b case b
when "%00" then "\0" when "%00" then "\0"
when "%25" then "%" when "%25" then "%"