Sha256: 86ad16dc0470b0a5d4d2c3a3ed0946495f6acfebb115243ab444cbb1172ec8b5

Contents?: true

Size: 990 Bytes

Versions: 19

Compression:

Stored size: 990 Bytes

Contents

module ARTest
  module SQLServer

    extend self

    attr_accessor :sql_counter_listenter

    def ignored_sql
      [ /SELECT SCOPE_IDENTITY/,
        /INFORMATION_SCHEMA\.(TABLES|VIEWS|COLUMNS)/,
        /SELECT @@version/,
        /SELECT @@TRANCOUNT/,
        /(BEGIN|COMMIT|ROLLBACK|SAVE) TRANSACTION/,
        /SELECT CAST\(.* AS .*\) AS value/ ]
    end

    def sql_counter_listenters
      ActiveSupport::Notifications.notifier.listeners_for('sql.active_record').select do |listener|
        listener.inspect =~ /ActiveRecord::SQLCounter/
      end
    end

    def sql_counter_listenters_unsubscribe
      sql_counter_listenters.each { |listener| ActiveSupport::Notifications.unsubscribe(listener) }
    end

  end
end

ActiveRecord::SQLCounter.ignored_sql.concat ARTest::SQLServer.ignored_sql
ARTest::SQLServer.sql_counter_listenters_unsubscribe
ARTest::SQLServer.sql_counter_listenter = ActiveSupport::Notifications.subscribe 'sql.active_record', ActiveRecord::SQLCounter.new

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
activerecord-sqlserver-adapter-4.2.18 test/support/sql_counter_sqlserver.rb
activerecord-sqlserver-adapter-4.2.17 test/support/sql_counter_sqlserver.rb
activerecord-sqlserver-adapter-4.2.16 test/support/sql_counter_sqlserver.rb
activerecord-sqlserver-adapter_new-4.2.15 test/support/sql_counter_sqlserver.rb
activerecord-sqlserver-adapter-4.2.15 test/support/sql_counter_sqlserver.rb
activerecord-sqlserver-adapter-4.2.13 test/support/sql_counter_sqlserver.rb
activerecord-sqlserver-adapter-4.2.12 test/support/sql_counter_sqlserver.rb
activerecord-sqlserver-adapter-4.2.11 test/support/sql_counter_sqlserver.rb
activerecord-sqlserver-adapter-4.2.10 test/support/sql_counter_sqlserver.rb
activerecord-sqlserver-adapter-4.2.9 test/support/sql_counter_sqlserver.rb
activerecord-sqlserver-adapter-4.2.8 test/support/sql_counter_sqlserver.rb
activerecord-sqlserver-adapter-4.2.6 test/support/sql_counter_sqlserver.rb
activerecord-sqlserver-adapter-4.2.5 test/support/sql_counter_sqlserver.rb
activerecord-sqlserver-adapter-4.2.4 test/support/sql_counter_sqlserver.rb
activerecord-sqlserver-adapter-4.2.3 test/support/sql_counter_sqlserver.rb
activerecord-sqlserver-adapter-4.2.2 test/support/sql_counter_sqlserver.rb
activerecord-sqlserver-adapter-4.2.1 test/support/sql_counter_sqlserver.rb
activerecord-sqlserver-adapter-4.2.0 test/support/sql_counter_sqlserver.rb
activerecord-sqlserver-adapter-4.2.0.pre test/support/sql_counter_sqlserver.rb