Module: ActiveRecord::ConnectionHandling
- Defined in:
- lib/active_record/connection_adapters/hbase_adapter.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#hbase_connection(config) ⇒ Object
Establishes a connection to the database that’s used by all Active Record objects.
Instance Method Details
#hbase_connection(config) ⇒ Object
Establishes a connection to the database that’s used by all Active Record objects.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/active_record/connection_adapters/hbase_adapter.rb', line 17 def hbase_connection(config) config = config.symbolize_keys config[:username] = 'root' if config[:username].nil? if !config[:m2debug].nil? ### FOR DEBUGGING ONLY ### if Mysql2::Client.const_defined? :FOUND_ROWS config[:flags] = Mysql2::Client::FOUND_ROWS end config[:host] = config[:m2host] config[:port] = config[:m2port] client = Mysql2::Client.new(config) ### FOR DEBUGGING ONLY ### else client = HbaseRestIface::Client.new(config) end = [config[:host], config[:username], config[:password], config[:database], config[:port], config[:socket], 0] ConnectionAdapters::HbaseAdapter.new(client, logger, , config) rescue Hbase::Error => error if error..include?("Unknown database") raise ActiveRecord::NoDatabaseError.new(error.) else raise error end end |