diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb index edd060248f3d9a4a09cf400d9a86d6a1e99f11ae..400b586c95ae2179cb44f4eeab099bbc2f7b7fc3 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb @@ -41,15 +41,6 @@ def sqlite3_connection(config) end module ConnectionAdapters #:nodoc: - class SQLite3Binary < Type::Binary # :nodoc: - def cast_value(value) - if value.encoding != Encoding::ASCII_8BIT - value = value.force_encoding(Encoding::ASCII_8BIT) - end - value - end - end - # The SQLite3 adapter works SQLite 3.6.16 or newer # with the sqlite3-ruby drivers (available as gem from https://rubygems.org/gems/sqlite3). # @@ -240,10 +231,6 @@ def _type_cast(value) # :nodoc: end end - def type_classes_with_standard_constructor - super.merge(binary: SQLite3Binary) - end - def quote_string(s) #:nodoc: @connection.class.quote(s) end @@ -493,11 +480,6 @@ def rename_column(table_name, column_name, new_column_name) #:nodoc: protected - def initialize_type_map(m) - super - m.register_type(/binary/i, SQLite3Binary.new) - end - def table_structure(table_name) structure = exec_query("PRAGMA table_info(#{quote_table_name(table_name)})", 'SCHEMA').to_hash raise(ActiveRecord::StatementInvalid, "Could not find table '#{table_name}'") if structure.empty? diff --git a/activerecord/test/cases/types_test.rb b/activerecord/test/cases/types_test.rb index d35d34ff2d79c5680bedc297b6c267b400a22605..34b6f2e8a5396cba84364bb6377aa2fca45bb555 100644 --- a/activerecord/test/cases/types_test.rb +++ b/activerecord/test/cases/types_test.rb @@ -108,16 +108,6 @@ def test_type_equality assert_not_equal Type::Value.new(precision: 1), Type::Value.new(precision: 2) end - if current_adapter?(:SQLite3Adapter) - def test_binary_encoding - type = SQLite3Binary.new - utf8_string = "a string".encode(Encoding::UTF_8) - type_cast = type.type_cast_from_user(utf8_string) - - assert_equal Encoding::ASCII_8BIT, type_cast.encoding - end - end - def test_attributes_which_are_invalid_for_database_can_still_be_reassigned type_which_cannot_go_to_the_database = Type::Value.new def type_which_cannot_go_to_the_database.type_cast_for_database(*)