Class: ActiveRecord::ConnectionAdapters::MakaraAbstractAdapter

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

Defined Under Namespace

Classes: ActiveRecordPoolControl, ErrorHandler

Constant Summary collapse

SQL_MASTER_MATCHERS =
[/\A\s*select.+for update\Z/i, /select.+lock in share mode\Z/i, /\A\s*select.+(nextval|currval|lastval|get_lock|release_lock|pg_advisory_lock|pg_advisory_unlock)\(/i].map(&:freeze).freeze
SQL_SLAVE_MATCHERS =
[/\A\s*(select|with.+\)\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, #control, #error_handler, #sticky

Instance Method Summary collapse

Methods inherited from Makara::Proxy

control_method, #default_shard_for, #disconnect!, #graceful_connection_for, hijack_method, #hijacked?, #method_missing, #respond_to_missing?, send_to_all, #shard_aware_for, #stick_to_master!, #strategy_class_for, #strategy_for, #strategy_name_for, #without_sticking

Constructor Details

#initialize(config) ⇒ MakaraAbstractAdapter

Returns a new instance of MakaraAbstractAdapter.



119
120
121
122
123
# File 'lib/active_record/connection_adapters/makara_abstract_adapter.rb', line 119

def initialize(config)
  @error_handler = ::ActiveRecord::ConnectionAdapters::MakaraAbstractAdapter::ErrorHandler.new
  @control = ActiveRecordPoolControl.new(self)
  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



111
112
113
# File 'lib/active_record/connection_adapters/makara_abstract_adapter.rb', line 111

def sql_all_matchers
  SQL_ALL_MATCHERS
end

#sql_master_matchersObject



103
104
105
# File 'lib/active_record/connection_adapters/makara_abstract_adapter.rb', line 103

def sql_master_matchers
  SQL_MASTER_MATCHERS
end

#sql_skip_stickiness_matchersObject



115
116
117
# File 'lib/active_record/connection_adapters/makara_abstract_adapter.rb', line 115

def sql_skip_stickiness_matchers
  SQL_SKIP_STICKINESS_MATCHERS
end

#sql_slave_matchersObject



107
108
109
# File 'lib/active_record/connection_adapters/makara_abstract_adapter.rb', line 107

def sql_slave_matchers
  SQL_SLAVE_MATCHERS
end