From 0f276de5127a1ede5232026ffed36bae086e6aec Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 26 Sep 2005 21:04:36 +0000 Subject: r3597@asus: jeremy | 2005-09-26 17:39:23 -0700 Minor improvement to SQLite adapter blob escaping. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2351 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../lib/active_record/connection_adapters/sqlite_adapter.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb index d1929f74e4..fe48d1f807 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb @@ -61,17 +61,17 @@ module ActiveRecord module ConnectionAdapters #:nodoc: class SQLiteColumn < Column #:nodoc: def string_to_binary(value) - value.gsub(/(\0|\%)/) do - case $1 + value.gsub(/\0|\%/) do |b| + case b when "\0" then "%00" - when "%" then "%25" + when "%" then "%25" end end end def binary_to_string(value) - value.gsub(/(%00|%25)/) do - case $1 + value.gsub(/%00|%25/) do |b| + case b when "%00" then "\0" when "%25" then "%" end -- cgit v1.2.3