Sha256: 76ef220d5aa7c87b4e8413fef657721a849fe32bac2f5c450c571c430a20e4e0

Contents?: true

Size: 597 Bytes

Versions: 21

Compression:

Stored size: 597 Bytes

Contents

require 'mysql2'
require 'flydata-core/mysql/config'

module Flydata
  module SourceMysql
    module MysqlAccessible
      def initialize(conf)
        @conf = conf
        @mysql_db_opts = build_mysql_db_opts(conf)
      end

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

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

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

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
flydata-0.7.13 lib/flydata/source_mysql/mysql_accessible.rb