Sha256: 71c750ce8d35d8cb8afb8aef1d247254d4b58d0abe3dff3328750ab0e42faec8

Contents?: true

Size: 672 Bytes

Versions: 1

Compression:

Stored size: 672 Bytes

Contents

module DatabaseFlusher
  module ActiveRecord
    class Mysql2Adapter < AbstractAdapter
      def initialize(connection)
        super
        flags = raw_connection.query_options[:flags]
        unless flags.include?('MULTI_STATEMENTS'.freeze)
          raise 'MULTI_STATEMENTS flag is not enabled'
        end
      end

      private

      def execute_multi(sql)
        connection.disable_referential_integrity do
          _result = raw_connection.query sql
          while raw_connection.next_result
            # just to make sure that all queries are finished
            _result = raw_connection.store_result
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
database_flusher-0.2.0 lib/database_flusher/active_record/adapters/mysql2_adapter.rb