Sha256: 3c64642fca484eb0cf8071f9adb6a31f3ef8913938eb1d0e15668f6a74b8e574

Contents?: true

Size: 715 Bytes

Versions: 13

Compression:

Stored size: 715 Bytes

Contents

module ARTest
  module SQLServer

    module SqlCounterSqlserver

      # Only return the log vs. log_all
      def capture_sql_ss
        ActiveRecord::SQLCounter.clear_log
        yield
        ActiveRecord::SQLCounter.log.dup
      end

    end

    ignored_sql = [
      /INFORMATION_SCHEMA\.(TABLES|VIEWS|COLUMNS|KEY_COLUMN_USAGE)/im,
      /SELECT @@version/,
      /SELECT @@TRANCOUNT/,
      /(BEGIN|COMMIT|ROLLBACK|SAVE) TRANSACTION/,
      /SELECT CAST\(.* AS .*\) AS value/,
      /SELECT DATABASEPROPERTYEX/im
    ]

    sqlcounter = ObjectSpace.each_object(ActiveRecord::SQLCounter).to_a.first
    sqlcounter.instance_variable_set :@ignore, Regexp.union(ignored_sql.push(sqlcounter.ignore))

  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
activerecord-jdbcsqlserver-adapter-52.0.0 test/support/sql_counter_sqlserver.rb
activerecord-jdbcsqlserver-adapter-51.1.0 test/support/sql_counter_sqlserver.rb
activerecord-sqlserver-adapter-5.2.1 test/support/sql_counter_sqlserver.rb
activerecord-jdbcsqlserver-adapter-51.0.1 test/support/sql_counter_sqlserver.rb
activerecord-jdbcsqlserver-adapter-51.0.0 test/support/sql_counter_sqlserver.rb
activerecord-sqlserver-adapter-5.2.0 test/support/sql_counter_sqlserver.rb
activerecord-sqlserver-adapter-5.2.0.rc2 test/support/sql_counter_sqlserver.rb
activerecord-sqlserver-adapter-5.2.0.rc1 test/support/sql_counter_sqlserver.rb
activerecord-sqlserver-adapter-5.1.6 test/support/sql_counter_sqlserver.rb
activerecord-sqlserver-adapter-5.1.5 test/support/sql_counter_sqlserver.rb
activerecord-sqlserver-adapter-5.1.2 test/support/sql_counter_sqlserver.rb
activerecord-sqlserver-adapter-5.1.1 test/support/sql_counter_sqlserver.rb
activerecord-sqlserver-adapter-5.1.0 test/support/sql_counter_sqlserver.rb