Sha256: 058d8f1f81513c7dbdaf781e1c26ffb9e596f3586ce5d417f3c295ec3e743601

Contents?: true

Size: 963 Bytes

Versions: 14

Compression:

Stored size: 963 Bytes

Contents

# -*- encoding : utf-8 -*-
module ActiveRecord
  module ConnectionAdapters
    class AbstractAdapter
      def match _string
        raise "match not implemented"
      end

      def cast_types
        native_database_types.merge custom_cast_types
      end

      def custom_cast_types
        {}
      end
    end

    class PostgreSQLAdapter
      def match string
        "~* #{string}"
      end
    end

    module MysqlCommon
      def match string
        "REGEXP #{string}"
      end

      def custom_cast_types
        { string:  { name: "char"    },
          integer: { name: "signed"  },
          text:    { name: "char"    },
          float:   { name: "decimal" },
          binary:  { name: "binary"  }  }
      end
    end

    class MysqlAdapter
      include MysqlCommon
    end

    class Mysql2Adapter
      include MysqlCommon
    end

    class SQLiteAdapter
      def match string
        "REGEXP #{string}"
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
card-1.91 lib/active_record/connection_adapters_ext.rb
card-1.21.0 lib/active_record/connection_adapters_ext.rb
card-1.20.4 lib/active_record/connection_adapters_ext.rb
card-1.20.3 lib/active_record/connection_adapters_ext.rb
card-1.20.2 lib/active_record/connection_adapters_ext.rb
card-1.20.1 lib/active_record/connection_adapters_ext.rb
card-1.20.0 lib/active_record/connection_adapters_ext.rb
card-1.19.6 lib/active_record/connection_adapters_ext.rb
card-1.19.5 lib/active_record/connection_adapters_ext.rb
card-1.19.4 lib/active_record/connection_adapters_ext.rb
card-1.19.3 lib/active_record/connection_adapters_ext.rb
card-1.19.2 lib/active_record/connection_adapters_ext.rb
card-1.19.1 lib/active_record/connection_adapters_ext.rb
card-1.19.0 lib/active_record/connection_adapters_ext.rb