Module: Flydata::SourceMysql::MysqlAccessible

Included in:
SyncDatabaseSizeCheck, SyncRepair::BinarylogsCheck
Defined in:
lib/flydata/source_mysql/mysql_accessible.rb

Instance Method Summary collapse

Instance Method Details

#build_mysql_db_opts(conf) ⇒ Object



21
22
23
# File 'lib/flydata/source_mysql/mysql_accessible.rb', line 21

def build_mysql_db_opts(conf)
  FlydataCore::Mysql::Config.build_mysql_db_opts(conf)
end

#exec_mysql_query(query) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/flydata/source_mysql/mysql_accessible.rb', line 12

def exec_mysql_query(query)
  cli = mysql_client
  cli.query(query)
ensure
  if cli
    cli.close rescue nil
  end
end

#initialize(conf) ⇒ Object



7
8
9
10
# File 'lib/flydata/source_mysql/mysql_accessible.rb', line 7

def initialize(conf)
  @conf = conf
  @mysql_db_opts = build_mysql_db_opts(conf)
end

#mysql_clientObject



25
26
27
# File 'lib/flydata/source_mysql/mysql_accessible.rb', line 25

def mysql_client
  Mysql2::Client.new(@mysql_db_opts)
end