Sha256: 474f268c32965cf43ac39db68e2b3d5f0190a9c42ee51fe8d654638753a823e9

Contents?: true

Size: 702 Bytes

Versions: 1

Compression:

Stored size: 702 Bytes

Contents

# frozen_string_literal: true
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.1 lib/database_flusher/active_record/adapters/mysql2_adapter.rb