Sha256: ef27c5ace3a452b4e9a9115a0a77d904615a6c629cd0775d00749f74b66e9b7e

Contents?: true

Size: 854 Bytes

Versions: 1

Compression:

Stored size: 854 Bytes

Contents

module ActiveRecord
  module Dowsing
    module PgConnectionPatch
      # https://bitbucket.org/ged/ruby-pg/src/050a996456b14e1086581b79b391f37af999d414/ext/pg_connection.c?at=default&fileviewer=file-view-default
      %i(
        async_exec
        exec_params
        send_query
      ).each do |method_name|
        module_eval(<<-INSERT_CALLER_LOCAION, __FILE__, __LINE__ + 1)
          def #{method_name}(sql, *)
            sql = Util.append_comment(sql)
            super
          end
        INSERT_CALLER_LOCAION
      end

      %i(
        prepare
        send_prepare
      ).each do |method_name|
        module_eval(<<-INSERT_CALLER_LOCAION, __FILE__, __LINE__ + 1)
          def #{method_name}(_, sql, *)
            sql = Util.append_comment(sql)
            super
          end
        INSERT_CALLER_LOCAION
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activerecord-dowsing-1.0.0 lib/active_record/dowsing/pg_connection_patch.rb