Spec-Zone.ru › Ruby on Rails 8.1

module ActiveRecord::ConnectionAdapters::PostgreSQL::DatabaseStatements

Общедоступные методы экземпляра

build_explain_clause (options = []) Показать исходный код
# File activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb, line 96
def build_explain_clause(options = [])
  return "EXPLAIN" if options.empty?

  "EXPLAIN (#{options.join(", ").upcase})"
end
explain (arel, binds = [], options = []) Показать исходный код
# File activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb, line 7
def explain(arel, binds = [], options = [])
  sql    = build_explain_clause(options) + " " + to_sql(arel, binds)
  result = internal_exec_query(sql, "EXPLAIN", binds)
  PostgreSQL::ExplainPrettyPrinter.new.pp(result)
end
high_precision_current_timestamp () Показать исходный код
# File activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb, line 92
def high_precision_current_timestamp
  HIGH_PRECISION_CURRENT_TIMESTAMP
end
set_constraints (deferred, *constraints) Показать исходный код
# File activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb, line 110
def set_constraints(deferred, *constraints)
  unless %i[deferred immediate].include?(deferred)
    raise ArgumentError, "deferred must be :deferred or :immediate"
  end

  constraints = if constraints.empty?
    "ALL"
  else
    constraints.map { |c| quote_table_name(c) }.join(", ")
  end
  execute("SET CONSTRAINTS #{constraints} #{deferred.to_s.upcase}")
end

Задать, когда будут проверяться ограничения для текущей транзакции.

Если не указать имена конкретных ограничений, значение будет задано для всех ограничений, допускающих отложенную проверку.

deferred

Допустимые значения: :deferred или :immediate.

См. www.postgresql.org/docs/current/sql-set-constraints.html

© 2004–2021 David Heinemeier Hansson
Licensed under the MIT License.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API