Sha256: 8a9b08fe107eeef728953248011b18db45150355ddc12932075421141d61d8ae
Contents?: true
Size: 583 Bytes
Versions: 2
Compression:
Stored size: 583 Bytes
Contents
# frozen_string_literal: true module ActiveRecordQueryCounter # Module to prepend to the connection adapter to inject the counting behavior. module ConnectionAdapterExtension def exec_query(sql, name = nil, binds = [], *args, **kwargs) start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) result = super if result.is_a?(ActiveRecord::Result) end_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) ActiveRecordQueryCounter.add_query(sql, name, binds, result.length, start_time, end_time) end result end end end
Version data entries
2 entries across 2 versions & 1 rubygems