Sha256: 5b2a29993c03a7501df2d9e21d754388c6fe4ca8dbd2a4e2c5dc764524bbd2ef
Contents?: true
Size: 1.64 KB
Versions: 2
Compression:
Stored size: 1.64 KB
Contents
# ActiveRecord 3.0 BACK PORT ONLY # https://github.com/brianmario/mysql2/commit/14accdf8d1bf557f652c19b870316094a7441334#diff-0 if ActiveRecord::VERSION::MAJOR == 3 && ActiveRecord::VERSION::MINOR <= 2 (require 'active_record/connection_adapters/abstract_mysql_adapter' if (ActiveRecord::VERSION::MAJOR == 3 && ActiveRecord::VERSION::MINOR == 2)) module ActiveRecord module ConnectionAdapters class Mysql2Adapter < ((ActiveRecord::VERSION::MAJOR == 3 && ActiveRecord::VERSION::MINOR == 2) ? AbstractMysqlAdapter : AbstractAdapter) # Force all tables to be cached for the life connection def cached_tables @cached_tables ||= {} end def tables(name = nil, database = nil, like =nil) return cached_tables[database] if cached_tables[database] && like.nil? cached_tables[database] ||= [] return [like] if like && cached_tables[database].include?(like) sql = "SHOW TABLES " sql << "IN #{quote_table_name(database)} " if database sql << "LIKE #{quote(like)}" if like result = execute(sql, 'SCHEMA') cached_tables[database] = (cached_tables[database] | result.collect { |field| field[0] }).compact end alias :new_tables :tables def table_exists?(name) return false unless name 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(nil, schema, table).include?(table) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
connection_manager-0.3.9 | lib/connection_manager/patches/cross_schema_patch.rb |
connection_manager-0.3.8 | lib/connection_manager/patches/cross_schema_patch.rb |