Sha256: 80af98fa74d9cce4b162ba833598fa16cad69f7b673b64cc8b0689dc53165092

Contents?: true

Size: 890 Bytes

Versions: 1

Compression:

Stored size: 890 Bytes

Contents

# ActiveRecord 3.0 BACK PORT ONLY
# https://github.com/brianmario/mysql2/commit/14accdf8d1bf557f652c19b870316094a7441334#diff-0

if ActiveRecord::VERSION::MAJOR == 3 && ActiveRecord::VERSION::MINOR == 0
  module ActiveRecord
    module ConnectionAdapters
      class Mysql2Adapter < AbstractAdapter     
        def tables(name = nil, database = nil) #:nodoc:
          sql = ["SHOW TABLES", database].compact.join(' IN ')
          execute(sql, 'SCHEMA').collect do |field|
            field.first
          end
        end
      
        def table_exists?(name)
          return true if super
          name          = name.to_s
          schema, table = name.split('.', 2)
          unless table # A table was provided without a schema
            table  = schema
            schema = nil
          end
          tables(nil, schema).include? table
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
connection_manager-0.2.5 lib/connection_manager/cross_schema_patch.rb