instance method execute_and_clear

Ruby on Rails 7.2.3

Since v4.2.9 Last seen in v7.2.3 Private

Available in: v4.2.9 v5.2.8.1 v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3

Signature

execute_and_clear(sql, name, binds, prepare: false, async: false, allow_retry: false, materialize_transactions: true)

No documentation comment.

Parameters

sql req
name req
binds req
prepare key = false
async key = false
allow_retry key = false
materialize_transactions key = true
Source
# File activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb, line 872
        def execute_and_clear(sql, name, binds, prepare: false, async: false, allow_retry: false, materialize_transactions: true)
          sql = transform_query(sql)
          check_if_write_query(sql)

          if !prepare || without_prepared_statement?(binds)
            result = exec_no_cache(sql, name, binds, async: async, allow_retry: allow_retry, materialize_transactions: materialize_transactions)
          else
            result = exec_cache(sql, name, binds, async: async, allow_retry: allow_retry, materialize_transactions: materialize_transactions)
          end
          begin
            ret = yield result
          ensure
            result.clear
          end
          ret
        end

Defined in activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb line 872 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::ConnectionAdapters::PostgreSQLAdapter

Type at least 2 characters to search.

↑↓ navigate · open · esc close