Sha256: 08b555260da4c75724ef455e1fa1473c75cced8dc26b84f0500e4ee52d57201e

Contents?: true

Size: 757 Bytes

Versions: 2

Compression:

Stored size: 757 Bytes

Contents

require 'mysql2'

require 'mysql2_query_filter/version'

require 'mysql2_query_filter/base'
require 'mysql2_query_filter/mysql2_client_ext'
require 'mysql2_query_filter/plugin'
require 'mysql2_query_filter/query_filter'

Mysql2::Client.class_eval do
  include Mysql2QueryFilter::Mysql2ClientExt
end

module Mysql2QueryFilter
  @@query_filter = Mysql2QueryFilter::QueryFilter.new
  @@enabled = false

  def self.configure
    yield(@@query_filter)
  end

  def self.filter(sql, query_options)
    @@query_filter.filter(sql, query_options) if @@enabled
  end

  def self.enable!
    @@enabled = true
  end

  def self.disable!
    @@enabled = false
  end

  def self.disable!
    @@enabled = false
  end

  def self.clear!
    @@query_filter.clear!
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mysql2_query_filter-0.1.1 lib/mysql2_query_filter.rb
mysql2_query_filter-0.1.0 lib/mysql2_query_filter.rb