Sha256: 34d6ad431dc982d75a6f3f889a18f5c0085e920b128b49813dcc2f517c124628

Contents?: true

Size: 881 Bytes

Versions: 8

Compression:

Stored size: 881 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 new_tables(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
          new_tables(schema).include? table
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
connection_manager-0.3.7 lib/connection_manager/patches/cross_schema_patch.rb
connection_manager-0.3.6 lib/connection_manager/patches/cross_schema_patch.rb
connection_manager-0.3.5 lib/connection_manager/patches/cross_schema_patch.rb
connection_manager-0.3.4 lib/connection_manager/patches/cross_schema_patch.rb
connection_manager-0.3.3 lib/connection_manager/patches/cross_schema_patch.rb
connection_manager-0.3.2 lib/connection_manager/patches/cross_schema_patch.rb
connection_manager-0.3.1 lib/connection_manager/patches/cross_schema_patch.rb
connection_manager-0.3.0 lib/connection_manager/patches/cross_schema_patch.rb