Class: ActiveRecord::ConnectionAdapters::MakaraAbstractAdapter

Inherits:
Makara::Proxy
  • Object
show all
Defined in:
lib/active_record/connection_adapters/makara_abstract_adapter.rb

Direct Known Subclasses

MakaraMysql2Adapter, MakaraPostgreSQLAdapter

Defined Under Namespace

Classes: ErrorHandler

Constant Summary collapse

SQL_MASTER_MATCHERS =
[/\A\s*select.+for update\Z/i, /select.+lock in share mode\Z/i].map(&:freeze).freeze
SQL_SLAVE_MATCHERS =
[/\A\s*select\s/i].map(&:freeze).freeze
SQL_ALL_MATCHERS =
[/\A\s*set\s/i].map(&:freeze).freeze
SQL_SKIP_STICKINESS_MATCHERS =
[/\A\s*show\s([\w]+\s)?(field|table|database|schema|view|index)(es|s)?/i, /\A\s*(set|describe|explain|pragma)\s/i].map(&:freeze).freeze

Constants inherited from Makara::Proxy

Makara::Proxy::METHOD_MISSING_SKIP

Instance Attribute Summary

Attributes inherited from Makara::Proxy

#config_parser, #error_handler, #sticky

Instance Method Summary collapse

Methods inherited from Makara::Proxy

#disconnect!, #graceful_connection_for, hijack_method, #hijacked?, #method_missing, send_to_all, #stick_to_master!, #strategy_for, #without_sticking

Constructor Details

#initialize(config) ⇒ MakaraAbstractAdapter

Returns a new instance of MakaraAbstractAdapter.



137
138
139
140
# File 'lib/active_record/connection_adapters/makara_abstract_adapter.rb', line 137

def initialize(config)
  @error_handler = ::ActiveRecord::ConnectionAdapters::MakaraAbstractAdapter::ErrorHandler.new
  super(config)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Makara::Proxy

Instance Method Details

#sql_all_matchersObject



127
128
129
# File 'lib/active_record/connection_adapters/makara_abstract_adapter.rb', line 127

def sql_all_matchers
  SQL_ALL_MATCHERS
end

#sql_master_matchersObject



117
118
119
# File 'lib/active_record/connection_adapters/makara_abstract_adapter.rb', line 117

def sql_master_matchers
  SQL_MASTER_MATCHERS
end

#sql_skip_stickiness_matchersObject



132
133
134
# File 'lib/active_record/connection_adapters/makara_abstract_adapter.rb', line 132

def sql_skip_stickiness_matchers
  SQL_SKIP_STICKINESS_MATCHERS
end

#sql_slave_matchersObject



122
123
124
# File 'lib/active_record/connection_adapters/makara_abstract_adapter.rb', line 122

def sql_slave_matchers
  SQL_SLAVE_MATCHERS
end